{"id":33,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/the-zero-and-the-identity-matrices\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"the-zero-and-the-identity-matrices","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/the-zero-and-the-identity-matrices\/","title":{"rendered":"The Zero and the Identity Matrices"},"content":{"rendered":"
If you recall your elementary school math experience, you hopefully remember that anything plus zero doesn\u2019t change the original num\u00adber, nor does anything multiplied by one. Well, the same thing is true for matrices. For addition and subtraction of matrices you use what is<\/p>\n
<\/p>\n
known as the zero matrix. Adding or subtracting a zero matrix to or from any other matrix will result in a matrix identical to the original, just like adding zero to a real number gives you your original number. A zero matrix is exactly what it sounds like, a matrix full of zeros. Every element in the zero matrix contains a value of zero. A 3×3 zero matrix is shown in Figure 1.3.<\/p>\n
The identity matrix takes the place of the one in multiplication. Any matrix multiplied by the identity matrix will be exactly the same as the original matrix. The identity matrix is a square matrix that contains all zeros, with the exception of the diagonal. The diagonal elements starting at the top-left of the matrix and traveling to the bottom right contain ones instead of zeros. Why ones and zeros? The reason for this goes back to the definition of a matrix as a system of equations. The elements in a matrix represent the coefficients of that system. If you remember back to algebra again, when all of the coefficients in one of the equations is zero but one, it means you have solved for that vari\u00adable. An identity matrix is just that. For each row or column there is a single \u201cone,\u201d meaning the system of equations has been solved. Setting a matrix to the identity matrix essentially \u201cresets\u201d the matrix.<\/p>\n
For example, if the matrix is being used to position geometry, such as the case with OpenGL\u2019s Modelview matrix, changing the matrix to the identity matrix (via glLoadIdentity() in OpenGL) will cause the next parts of the geometry received to be drawn relative to the origin again, rather than relative to the position specified by the previous matrix. Figure 1.3 shows the 3×3 identity matrix.<\/p>\n
\n<\/td>\n | \n "o<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n o"<\/p>\n<\/td>\n | \n<\/td>\n | \n ~1<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n o"<\/p>\n<\/td>\n<\/tr>\n | |
\n A =<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 1 =<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 1<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n<\/tr>\n | |
\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 0<\/p>\n<\/td>\n | \n 1<\/p>\n<\/td>\n<\/tr>\n<\/table>\n
|