Step 1 — Scalar. How many numbers? Just one.
N0=1Why this step? Rank 0 means no index ranges over anything.
Step 2 — Vector of length n. Index i runs 1→n.
N1=nWhy this step? One index, n choices.
Step 3 — Matrix m×n. For each of the m rows, there are n columns.
N2=m⋅nWhy this step? Independent choices multiply (fundamental counting principle).
Step 4 — Tensor d1×⋯×dk. Generalize: multiply every axis length.
Nk=r=1∏kdrWhy this step? Each index contributes an independent multiplicative factor — exactly like nested loops.
How many indices address one element of a rank-k tensor?
Exactly k.
A scalar is a tensor of what rank?
Rank 0.
Shape of a vector in Rn vs a matrix in Rm×n?
Vector: (n,), rank 1. Matrix: (m,n), rank 2.
Total number of elements in a d1×⋯×dk tensor?
∏r=1kdr.
What does (A⊤)ij equal?
Aji (swap the two indices).
Shape of a batch of 64 RGB 28×28 images?
(64,28,28,3), a rank-4 tensor.
Why is a 1×n matrix NOT the same as an n-vector?
Different rank (2 vs 1) and shape; they broadcast/multiply differently.
"Tensor rank/order" vs "matrix rank" — difference?
Order = number of axes; matrix rank = number of linearly independent rows/columns.
Memory of a float32 tensor with N elements?
4N bytes.
Transpose of a scalar?
The scalar itself (a⊤=a).
Recall Feynman: explain to a 12-year-old
Imagine boxes of numbers.
A scalar is one number on a sticky note.
A vector is a single row of lockers — say which locker (one number) and you get its value.
A matrix is a whole wall of lockers — you say the row and the column (two numbers).
A tensor is a giant building with many walls, floors, and buildings — you keep giving more numbers until you've pointed at exactly one locker. The number of things you have to say to find one value is the "rank". Multiply all the sizes together and you know how many lockers (numbers) there are in total.
Dekho, ye chaar cheezein sirf numbers ke containers hain, aur inme fark sirf itna hai ki ek single number tak pahunchne ke liye tumhe kitne index batane padte hain. Scalar matlab akela number — 0 index (jaise loss ka value 3.7). Vector matlab ek line me numbers ki list — 1 index (jaise ek ghar ke features: bedrooms, area, price). Matrix matlab grid, rows aur columns — 2 index (row aur column dono batao). Aur tensor matlab isi cheez ka general version, jitne chaaho utne index — jaise ek batch of images me (image number, row, column, color) = 4 index.
Sabse important 20% jo 80% kaam karwa deta hai: rank = number of axes (indices). Jaise hi tum ye samajh gaye, shapes samajh aa jaayenge, matrix multiplication ke rules logical lagenge, aur memory ka hisaab bhi. Total elements nikalne ke liye bas saare axis ki lengths multiply kar do: ∏dr. Nested loops ki tarah — har index ek multiply factor deta hai.
Ek common galti: "rank" word do jagah use hota hai. Yahan tensor ka rank matlab kitne axes hain. Lekin "matrix rank" ek alag cheez hai (independent rows/columns). Confuse mat hona — safe rehne ke liye axes wale ko "order" bol do. Doosri galti: 1×n matrix aur n-vector ek jaise dikhte hain par rank alag hai (2 vs 1), aur code me broadcasting alag behave karta hai — yahi silent bug ka top reason hai.
ML me ye foundation hai: har data — chahe loss ho, ek example ho, weights ho, ya images ka batch — inhi me se ek hai. Toh index count wala mental model pakka kar lo, aage sab easy lagega.