Teaching Kids Programming – Linear Algebra: Using Matrix to Solve Equations of X and Y


Teaching Kids Programming: Videos on Data Structures and Algorithms

Given the following two equations:

tex_88a16a832fcbbb4a5365bc7ec87a4504 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y
tex_c9e1063f143f1751507315111cfab3e9 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

We can work on the X or Y in one equation and then substitue it in another equation. For example: from Equation 1, we know tex_7d5341564c90de3a74b54dd4192951e1 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y and we can plug in x into the second equation.

Linear Algebra: Using Matrix to Solve Equations of X and Y

Let’s put the coefficients of the above equations into the following matrix:

tex_b34c2de9a5142a584bc9c359a2c829d0 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

And then we can transform the above equations of x and y into the following matrix multiplication equation:

tex_c391d552edd68c311a03a784bb510f6d Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

How to Multiply Two Matrix?

Remember the multiplication rule for Matrix A times B: dot product of the rows of A with the columns of B. Thus, if the Matrix dimension for A is rows1, cols1, and the Matrix B has dimension rows2, cols2, then cols1 = rows2.

For example:

tex_8b320c12d328a87a22854cc68c6cf16d Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

In general tex_9c3d029b9a3fd39947f616bf85d860b6 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y for Matrix Multiplication.

Identity Matrix

Identity Matrix (IM) is the Matrix with all ones in the diagonals and zeros elsewhere. For example, the following is a 2×2 Identity Matrix:

tex_604ab295212b7f769fc503697b20a580 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

With the above matrix multiplication rules, we know that: tex_e025fd03c145683f1d587bbc22c46b24 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y for Matrix A, where I is the identity matrix.

How to Get Inverse of Matrix?

The inverse of a Matrix A is denoted as tex_d866fb421799ffd9586b9b970253de82 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y such that: tex_78ead14d079db70d966e5dc715380b6f Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y where I is the identity matrix.

We want to find out the x in matrix equation tex_c08aa9e263fe04f9a6cde67a6a59a90e Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y thus we can multiply the Inverse of Matrix tex_d866fb421799ffd9586b9b970253de82 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y in both sides:

tex_cc2b939fba611535bf3dc4c03dc71681 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y which becomes tex_825d9ddf17de6fba733b3ebfe484a1bd Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y and then tex_8e038f6f84557132b6bd3ceb1b20819a Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

For a 2×2 Matrix:

tex_f2853bbb7094e339aaae91e38f39639f Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

The inverse for Matrix A is:

tex_0588403cfa30a40caf48f157976a4bdc Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

where tex_4ac85332bbb0926e544e00411f0a6050 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y is called the determinant for 2×2 Matrix.

Let’s practice above to solve the original equations:

tex_8e038f6f84557132b6bd3ceb1b20819a Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y
tex_19770fde0ef455d6459afb4b65271571 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y
tex_a3ce02d8d2b61fe8a7969e1b83d553c7 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y
tex_13d98f0a091803111027c7b709c0f4b0 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

Thus, for the original equations: the solutions are tex_534133af40db44dca959d03ed0c552b6 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y and tex_a17e6269e1e44a03cfb464258ce5c402 Teaching Kids Programming - Linear Algebra: Using Matrix to Solve Equations of X and Y

–EOF (The Ultimate Computing & Technology Blog) —

1433 words
Last Post: Teaching Kids Programming - Pseudo-Palindromic Paths in a Binary Tree (Breadth First Search Algorithm, Iterative Preorder/Reversed Preorder)
Next Post: Teaching Kids Programming - Largest Substring Between Two Equal Characters (Hash Map)

The Permanent URL is: Teaching Kids Programming – Linear Algebra: Using Matrix to Solve Equations of X and Y (AMP Version)

Leave a Reply