Project DelphiTensors Workshop
Knowledge

The matrix product

The matrix product C = AB is defined only when A has as many columns as B has rows. If A is m × n and B is n × p, then C is m × p.

Each entry is a sum, Cᵢ,ⱼ = Σₖ Aᵢ,ₖ Bₖ,ⱼ. In words: Cᵢ,ⱼ is the dot product of row i of A with column j of B.

This is not the same as multiplying matching entries. That operation exists too: it is the element-wise or Hadamard product, written A ⊙ B. In NumPy the two are A @ B and A * B.