Matrix Operations and Inverses | Free Discrete Mathematics Lesson (4 College Credits) | UPI Study

UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 12.2 Free with a free account

Matrix Operations and Inverses

Discrete Mathematics · Chapter 12: Matrices and TransformationsSection 12.2 · lesson 78 of 8710 min · free with a free account

← Introduction to MatricesNext lesson: Rotation Matrices and Their Applications →

Earn 4 college credits for Discrete MathematicsRecommended for credit by NCCRS · Math 230 · self-paced · one payment, lifetime access

In this lesson

The arithmetic that turns a grid into a tool for solving equations.

  • Multiply matrices and check dimensions
  • Compute 2 × 2 and 3 × 3 determinants
  • Find and verify a 2 × 2 inverse
  • Solve a linear system with an inverse

Transcript

Everything said in the video, section by section (1,401 words). Read along, or search it.

Matrices and Transformations

Matrix Operations and Inverses

This section turns the matrix from a grid of numbers into a tool for solving equations. We'll multiply matrices, compute a single number called the determinant, and use it to find an inverse. Then we'll use that inverse to solve a system of linear equations outright.

The Opening Problem

Equations Collapsed Into One Formula

Suppose a machine learning practitioner fits a simple linear regression, predicting a house's price from its size and its age. The standard closed-form solution comes down to solving a small system of linear equations, for the model's coefficients. In matrix form, that system is A x equals b. And it has an exact solution, x equals A inverse times b, whenever the square matrix A has an inverse. The same idea, collapsing a system of equations into one matrix inversion, underlies circuit analysis, structural load calculations, and much more. This section develops the mechanics that make that formula usable. It's all algebraic here. Sections twelve point three and twelve point four add the geometric side.

12.2.1

Matrix Multiplication

Start with multiplication. Let A be an m by n matrix, and B an n by p matrix. The key is that the number of columns of A equals the number of rows of B. Their product, A B, is an m by p matrix. Take the entry in row i, column j of the product. It's the dot product of row i of A, with column j of B. Multiply term by term, then add. If A's column count doesn't match B's row count, the product A B simply isn't defined. That's not a convenience. Each output entry pairs a whole row of A against a whole column of B, so the two must be the same length to pair up completely.

Figure 1

Computing One Entry of AB

Here's a concrete case. A is two by three, with rows one, two, three, and four, five, six. B is three by two, with rows seven, eight, then nine, ten, then eleven, twelve. A has three columns, and B has three rows. They match, so A B is defined, and it will be two by two. To get the top left entry, pair row one of A with column one of B. One times seven, plus two times nine, plus three times eleven. That's seven plus eighteen plus thirty-three, which is fifty-eight. Every other entry of A B is a different row and column pairing of the same two matrices.

Worked Example

All 4 Entries of AB

Working out all four entries the same way. Row one with column two gives one times eight, plus two times ten, plus three times twelve, which is sixty-four. Row two with column one gives four times seven, plus five times nine, plus six times eleven, which is one hundred thirty-nine. And row two with column two gives one hundred fifty-four. So A B is the two by two matrix with rows fifty-eight, sixty-four, and one hundred thirty-nine, one hundred fifty-four.

Order Matters

BA Is a Different Shape Entirely

Now multiply in the other order. Something more surprising happens than just a different answer. B A is defined too, because B has two columns and A has two rows. But B is three by two, and A is two by three, so B A is three by three. That's a different shape entirely. Carrying out the same row and column pairing gives rows thirty-nine, fifty-four, sixty-nine, then forty-nine, sixty-eight, eighty-seven, then fifty-nine, eighty-two, one hundred five. So matrix multiplication is not commutative. Order can change not only the values, but the very dimensions of the result.

12.2.2

The 2 × 2 Determinant

Next, the determinant. For a two by two matrix with entries a, b in the top row, and c, d in the bottom row, the determinant is a d minus b c. Take A, with rows two, one, and five, three. Its determinant is two times three, minus one times five. Six minus five is one. Now take S, with rows two, four, and one, two. Its determinant is two times two, minus four times one. Four minus four is zero. That zero isn't a coincidence of these particular numbers. It's the exact signal that S has no inverse. A's nonzero determinant guarantees that A does have one.

3 × 3 in Brief

Cofactor Expansion Along Row 1

For a three by three matrix, the determinant uses cofactor expansion. Pick a row, usually the first. Delete one entry's row and column, and a smaller two by two matrix is left. Its determinant is called that entry's minor. Each entry is combined with its minor. The signs alternate: plus, minus, plus. Take M, with rows one, two, three, then zero, one, four, then five, six, zero. The three minors work out to minus twenty-four, minus twenty, and minus five. So the determinant is one times minus twenty-four, minus two times minus twenty, plus three times minus five. That's minus twenty-four, plus forty, minus fifteen, which is one. So a two by two determinant combines two products directly, and a three by three combines three minors, each a two by two determinant.

12.2.3

The Inverse Matrix

Now, the inverse. For a square matrix A, its inverse, A inverse, is the matrix that multiplies A from either side to give the identity. If no such matrix exists, A is called singular. Otherwise, it's nonsingular. Here's the central fact. A square matrix is invertible if and only if its determinant is not zero. For a two by two matrix, there's a direct formula. Swap a and d, negate b and c, and then divide every entry by the determinant.

Worked Example

Computing and Verifying an Inverse

Let's use it on A, with rows two, one, and five, three, whose determinant is one. Swapping and negating gives rows three, minus one, and minus five, two. Dividing by one changes nothing. Check it. Multiplying A by this matrix gives six minus five, then minus two plus two, then fifteen minus fifteen, then minus five plus six. That's one, zero, zero, one, the identity, so the inverse is confirmed. Why does a zero determinant rule out an inverse? Multiplying A by the formula gives a d minus b c times the identity, all divided by a d minus b c. That works whenever a d minus b c isn't zero. For S, the formula would divide by zero, which is undefined. So S has no inverse at all.

12.2.4

Solving a System With the Inverse

Here's the payoff. The system two x plus y equals seven, and five x plus three y equals seventeen, can be written as one matrix equation, A x equals b. A is the same matrix as before, x is the column of unknowns, and b is the column of constants, seven and seventeen. Multiply both sides on the left by A inverse. Since A inverse times A is the identity, the left side collapses to just x. So x equals A inverse times b. That's three times seven, minus seventeen, which is four. And minus five times seven, plus two times seventeen, which is minus one. So x is four and y is minus one. Substituting back confirms both original equations.

Table 2

What det(A) Settles, and What It Doesn't

This method depends entirely on A being invertible. When the determinant is nonzero, there's exactly one solution, given directly by A inverse times b. When the determinant is zero, the inverse method can't be used at all. But be careful. That alone doesn't say whether the system has no solution, or infinitely many. It depends on b. The method also scales awkwardly. A full n by n inverse needs n squared minors, each an n minus one by n minus one determinant, so the work grows rapidly. In practice, larger systems are solved with Gaussian elimination, combining the rows of A alongside b, to reach a solution directly. Still, the inverse method remains the clearest way to see why a nonzero determinant means a unique solution.

Takeaways

Multiply, Test, Invert, Solve

To summarize. Matrix multiplication needs the inner dimensions to match. An m by n matrix times an n by p matrix gives an m by p result, and A B and B A usually differ. A two by two determinant is a d minus b c. A three by three determinant reduces to three two by two determinants by cofactor expansion. A square matrix has an inverse exactly when its determinant is nonzero. And then A x equals b has the unique solution, A inverse times b. Here's something to think about. A matrix S has determinant zero, so a student concludes that S x equals b has no solutions. Using S, with rows two, four, and one, two, test that claim against two different choices of b. Is the student's conclusion justified?

About Discrete Mathematics at UPI Study

Discrete Mathematics (Math 230) is a self-paced online course of 87 video lessons in 13 chapters, from logic and proof to counting, probability, graph theory and trees. It carries a NCCRS credit recommendation for 4 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Why take it here

Why students take Discrete Mathematics with UPI Study

The math behind computer scienceDiscrete Mathematics is the mathematics of computer science: logic, proofs, sets, counting, probability and graphs underpin algorithms, data structures, cryptography and databases. Completing it now lets you qualify for those courses at your university.
Credit at a fraction of the priceThe same 4 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Discrete Mathematics carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Matrix Operations and Inverses

When can you multiply two matrices, and how do you find the size of the product?
Two matrices can be multiplied only when the number of columns of A equals the number of rows of B. If A is m \times n and B is n \times p, then AB is m \times p. Each entry is a row of A dotted with a column of B. A 2\times 3 times a 3\times 2 gives a 2\times 2, but BA is 3\times 3, so order matters.
How do you calculate a 2 × 2 and a 3 × 3 determinant?
For \begin{pmatrix} a & b \\ c & d \end{pmatrix}, the determinant is ad - bc. For rows (2,1) and (5,3), that is 6 - 5 = 1. For a 3\times 3 matrix, use cofactor expansion along a row. Multiply each entry by its 2\times 2 minor, with signs +,-,+, then add. For rows (1,2,3), (0,1,4), (5,6,0), you get -24 + 40 - 15 = 1.
How do you find the inverse of a 2 × 2 matrix and check that it's correct?
For \begin{pmatrix} a & b \\ c & d \end{pmatrix} with ad - bc \ne 0, swap a and d, negate b and c, and divide every entry by ad - bc. For rows (2,1) and (5,3), the determinant is 1, so the inverse has rows (3,-1) and (-5,2). Multiplying the two matrices gives the identity, which confirms it. If the determinant is 0, no inverse exists.
How do you solve a system of linear equations using a matrix inverse?
Write the system as A\mathbf{x} = \mathbf{b}, then multiply both sides on the left by A^{-1} to get \mathbf{x} = A^{-1}\mathbf{b}. For 2x + y = 7 and 5x + 3y = 17, A^{-1} has rows (3,-1) and (-5,2). This gives x = 21 - 17 = 4 and y = -35 + 34 = -1. If \det A = 0, this method fails, and it doesn't say whether there are zero or infinitely many solutions.

About the Discrete Mathematics course

How many college credits is Discrete Mathematics?
Discrete Mathematics (Math 230) carries a NCCRS credit recommendation for 4 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Discrete Mathematics cost and what is included?
$250, paid once, with lifetime access: all 87 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Discrete Mathematics take?
It is self-paced with no deadlines. The 87 lessons total about 13 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 4 credits in Discrete Mathematics.

87 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Discrete Mathematics
4 credits · NCCRS
Enroll →