Adding a column of shape (3,1) to a row of shape (1,3) gives a (3,3) grid. NumPy aligns shapes from the right and stretches every length-1 axis by setting its stride to 0, so the same number in memory is re-read across the output rather than copied. Two differing non-1 axes cannot align and raise an error.
Broadcasting: stretch, don't copy
A column (3,1) plus a row (1,3) fills a (3,3) grid. Each length-1 axis is re-read, not duplicated — the value stays put and its stride becomes 0.
source value (reused)stride 0 — re-read, not copieda[i] + b[j]
the rule
Line shapes up from the right.
An axis that is 1 (or missing) stretches — NumPy sets its stride to 0, so the same number is re-read.
Two axes with different non-1 lengths can't align → error.
Hover a result cell — its two sources light up. The gray copies were never written to memory: broadcasting is reading one value many times through a zero stride.