Tensor Addition
Tensors can be added together to create new tensors. You will use the example of matrices in this chapter, but the concept can be extended to tensors with any rank. Matrices may be added to scalars, vectors, and other matrices under certain conditions in a process known as broadcasting. Broadcasting refers to the process of array arithmetic on tensors of different shapes.
Two matrices may be added (or subtracted) together if they have the same shape. For such matrix-matrix addition, the resultant matrix is determined by the element-wise addition of the input matrices. The resultant matrix will therefore have the same shape as the two input matrices. You can define the matrix Z = [Z
ij]
as the matrix sum Z = X + Y
, where z
ij = x
ij +
y
ij and each element in Z
is the sum of the same element in X
and Y
.
Matrix addition is commutative, which means that the order of X
and Y
does not matter, that is, X + Y = Y + X
. Matrix addition is also associative, which ...