# Operations with matrices

Posted In: Mathematics
1. Two matroces A and B are equal if, and only if, they are both of the same shape \$mxn\$ and corresponding elemts are equal, i.e. \$[a_{ij}\ ]=[b_{ij}\ ]\$
2. Two matrices A and B can be added (or subtracted) if, and only if, they have the same shape \$mxn\$. And in the resultant matrix each of teh corresponding will be added (subtracted).
If
\$A=[a_{ij}\ ]=[\table a_11, a_12, a_13; a_21, a_22, a_23; a_31, a_32, a_32]\$
and
\$B=[b_{ij}\ ]=[\table b_11, b_12, b_13; b_21, b_22, b_23; b_31, b_32, b_32]\$
then
\$A+B=[a_{ij}+b_{ij}\ ]=[\table a_11+b_11, a_12+b_12, a_13+b_13; a_21+b_21, a_22+b_22, a_23+b_23; a_31+b_31, a_32+b_32, a_33+b_33]\$
3. If k is a scalar, and \$A=[a_{ij}]\$ is a matrix, then
\$kA=[ka_{ij}]=[\table ka_11,ka_12,…,ka_{1n};ka_21,ka_22,…,ka_{2n};…,…,…,…;ka_{m1},ka_{m2},…,ka_{mn}]\$
4. Multiple of Two Matrices
Two matrices can be multiplied together only when the number of columns in the first is equal to the number of rows in the second.
If
\$A=[a_{ij}\ ]=[\table a_11,a_12,…,a_{1n};a_21,a_22,…,a_{2n};…,…,…,…;a_{m1},a_{m2},…,a_{mn}],\$
\$B=[b_{ij}\ ]=[\table b_11,b_12,…,b_{1n};b_21,b_22,…,b_{2n};…,…,…,…;b_{m1},b_{m2},…,b_{mn}],\$
then
\$AB=C=[\table c_11,c_12,…,c_{1n};c_21,c_22,…,c_{2n};…,…,…,…;c_{m1},c_{m2},…,c_{mn}]\$
where
\$c_{ij}=a_{i1}b_{1j}+a_{i2}b_{2j}+…+a_{in}b_{nj}=∑↙{λ=1}↖na_{iλ}b_{λj}\$
\$(i=1,2,…,m;j=1,2,…,k)\$
Thus if
\$A=[a_{ij}\ ]=[\table a_11,a_12,a_{13};a_21,a_22,a_{23}],\$
\$B=[b_{ij}\ ]=[\table b_11;b_21;b_{31}],\$
then
\$AB=[\table a_11,a_12,a_{13};a_21,a_22,a_{23}][\table b_11;b_21;b_{31}]\$
\$=[\table a_11b_1+a_12b_2+a_13b_3;a_21b_1+a_22b_2+a_23b_3]\$