← All notes

NumPy broadcasting: arrays with different shapes

Answer: The term broadcasting describes how NumPy treats arrays with different shapes during arithmetic operations. Subject to certain constraints, the smaller array is broadcast across the larger array so that they have compatible shapes. (S1)

Why it matters

The simplest case

Shape vocabulary

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: NumPy docs, Broadcasting — NumPy v2.5 Manual, BSD-3-Clause (numpy/numpy LICENSE.txt; Copyright (c) 2005-2026, NumPy Developers; https://github.com/numpy/numpy/blob/main/LICENSE.txt); NumPy docs, NumPy quickstart — NumPy v2.5 Manual, BSD-3-Clause (numpy/numpy LICENSE.txt; Copyright (c) 2005-2026, NumPy Developers; https://github.com/numpy/numpy/blob/main/LICENSE.txt).

Cite this

Permanent ID: iil:note:txf6kncx

iinventedlight. 2026. "NumPy broadcasting: arrays with different shapes." iinventedlight Library, iil:note:txf6kncx, version of 2026-11-04. https://iinventedlight.com/library/notes/numpy-broadcasting/. License: CC-BY-4.0.

@misc{iil_note_txf6kncx,
  author = {{iinventedlight}},
  title = {{NumPy broadcasting: arrays with different shapes}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/numpy-broadcasting/},
  note = {Permanent ID iil:note:txf6kncx. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/numpy-broadcasting.md.