17 Making and Understanding an Identity Matrix:
Making and Understanding an Identity Matrix:
1. An identity matrix is a square matrix where all diagonal elements are 1, and all off-diagonal elements are 0. It’s like the
number 1 in regular arithmetic because when you multiply any matrix by the identity matrix, you get the same matrix
back.
2. To open an Identity matrix in MATLAB, open it up with “>> I = […]” and fill in the bracket with the appropriate Matrix
values. For “Identity matrix”, in a 3 x 3 number grid, as said every element diagonally from the top left to the bottom
right is “1” and the adjacent ones not in the diagonal lining, are simply “0”.
3. To make a grid, it is important to note a semicolon ; in the command will move your elements/numbers on to the next
line. So, “>> I = [ 1 0 0; 0 1 0; 0 0 1]” allows you to make 3 elements for each of the 3 lines in the Identity Matrix.
4. In following this command structure, you can customize your Identity Matrix as you please in MATLAB.
1. To continue diagonally expanding your newly created “Identity Matrix”, whilst respecting the Matrix format, the “eye”
command is useful in doing such.
2. We began with a 3×3 grid for our identity matrix, however if we want to per se expand it to a 4×4, or 6×6, we can type
“eye”… (followed by our desired parallel grid size dimension). For example, respectively it would be eye(4) and eye(6).
1. Likewise, if we wish to diagonally reduce the grid, we can once again type “eye”… (followed by our desired parallel
grid size dimension). So eye(1) or eye(2) can also be used on your existing identity matrix to confine to dimensions of
your choosing!
1. But with MATLAB you aren’t restricted to singular dimensions, if you so desire to have your Matrix grid be (2 x 4), or
(5 x 3), you can follow your command “eye” with (2,4) and (5,3) respectively!