JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Matrix Arithmetic: Adding, Scaling, and the Transpose

Add two matrices entry by entry, stretch one by a scalar, and flip it across its diagonal to get its transpose. These are the gentle, entrywise operations — the warm-up before matrix multiplication.

Adding matrices entry by entry

Matrix addition is the friendliest operation of all: to add two matrices, just add the entries that sit in the same position. There is one rule — the two matrices must have the same dimensions, otherwise some entries would have no partner and the sum is undefined.

[ 2  -1 ]   [ 4   5 ]   [ 2+4   -1+5 ]   [ 6   4 ]
[ 0   3 ] + [ 1  -2 ] = [ 0+1    3-2 ] = [ 1   1 ]

Same shape in, same shape out. Add matching positions.
Adding two 2×2 matrices position by position.

Scalar multiplication: stretching a matrix

A scalar is just an ordinary number (to distinguish it from a matrix). Scalar multiplication means multiplying every entry of the matrix by that one number. Multiplying by 3 triples every entry; multiplying by −1 flips every sign, which is how we form the negative of a matrix and therefore how we subtract: A − B = A + (−1)B.

          [ 2  -1 ]   [ 3*2   3*(-1) ]   [ 6  -3 ]
     3 *  [ 0   4 ] = [ 3*0   3*4    ] = [ 0  12 ]

Subtraction via scaling by -1:
[ 5  2 ]   [ 1  3 ]   [ 5  2 ]   [ -1  -3 ]   [ 4  -1 ]
[ 1  0 ] - [ 2  4 ] = [ 1  0 ] + [ -2  -4 ] = [-1  -4 ]
Scaling by 3, and subtracting by adding (−1) times a matrix.

The transpose: flip across the diagonal

The transpose of a matrix A, written A^T, turns its rows into columns and its columns into rows. The first row becomes the first column, the second row becomes the second column, and so on — like reflecting the grid across its main diagonal. A 2 × 3 matrix transposes into a 3 × 2 matrix; the dimensions swap.

        [ 2  -1   0 ]                 [  2   5 ]
  A  =  [ 5   3   7 ]    =>    A^T =  [ -1   3 ]
        (2 x 3)                       [  0   7 ]
                                       (3 x 2)

Row 1 of A  ->  Column 1 of A^T
The entry a(i,j) lands at position (j,i).
Transposing swaps rows with columns; entry (i,j) moves to (j,i).