WishWasTraining Academy
NDA & Naval Academy entrance exam school
โ† home
Chapter M2-4 ยท 4 of 4 in Matrices and Determinants ยท 14 min read

Matrix method and Cramer's rule: solving linear equations

9 real NDA questions of this kind in the 19 papers of 2017 to 2026.

Try three questions free โ†“
This chapter has a video lessonWatch it, practise with a drill and keep your record, all with a free account. No fee, no card.

Why this chapter matters. This chapter drew 3 real questions in the seven papers from NDA II 2023 to NDA II 2026: one on whether a system has a solution, one on Cramer's rule, and one on a system with letters in place of numbers. The count is small, but the chapter uses everything in this unit, and the question "how many solutions?" can be answered in seconds. Two of the real questions are solved in section 7, followed by three practice questions in the exam style.

What you will be able to do

  • Write a system of linear equations as one matrix equation โ€‹AX = Bโ€‹.
  • Solve a system by Cramer's rule and by the matrix method.
  • Say, without solving, whether a system has one solution, no solution or infinitely many.
  • Find the value of a constant for which a homogeneous system has a non-zero solution.

Before you start you should know: how to find a determinant (Chapter M2-2) and the inverse of a matrix (Chapter M2-3).

1. A system as one matrix equation

Take the system โ€‹2x + 3y = 8โ€‹, โ€‹x - y = -1โ€‹. Put the coefficients in a matrix โ€‹Aโ€‹, the unknowns in a column โ€‹Xโ€‹ and the constants in a column โ€‹Bโ€‹:

\begin{bmatrix} 2 & 3 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 8 \\ -1 \end{bmatrix}, \quad \text{that is} \quad AX = B

โ€‹Aโ€‹ is called the coefficient matrix. Its determinant is written โ€‹Dโ€‹ (or โ€‹\Deltaโ€‹). Before you read off โ€‹Aโ€‹ and โ€‹Bโ€‹, write every equation with the unknowns on the left, in the same order, and the constant on the right.

A system is consistent if it has at least one solution, and inconsistent if it has none.

2. Cramer's rule

For three equations โ€‹a_1x + b_1y + c_1z = d_1โ€‹, โ€‹a_2x + b_2y + c_2z = d_2โ€‹, โ€‹a_3x + b_3y + c_3z = d_3โ€‹, make four determinants:

  • โ€‹Dโ€‹: the determinant of the coefficients.
  • โ€‹D_1โ€‹: replace the first column of โ€‹Dโ€‹ (the โ€‹xโ€‹ column) by the constants โ€‹d_1, d_2, d_3โ€‹.
  • โ€‹D_2โ€‹: replace the second column (the โ€‹yโ€‹ column) by the constants.
  • โ€‹D_3โ€‹: replace the third column (the โ€‹zโ€‹ column) by the constants.

If โ€‹D \ne 0โ€‹, the system has exactly one solution:

x = \frac{D_1}{D}, \qquad y = \frac{D_2}{D}, \qquad z = \frac{D_3}{D}

For two equations in two unknowns the rule is the same, with โ€‹Dโ€‹, โ€‹D_1โ€‹ and โ€‹D_2โ€‹ of order 2. For the system in section 1:

โ€‹D = \begin{vmatrix} 2 & 3 \\ 1 & -1 \end{vmatrix} = -5โ€‹, โ€‹D_1 = \begin{vmatrix} 8 & 3 \\ -1 & -1 \end{vmatrix} = -5โ€‹, โ€‹D_2 = \begin{vmatrix} 2 & 8 \\ 1 & -1 \end{vmatrix} = -10โ€‹.

So โ€‹x = \dfrac{-5}{-5} = 1โ€‹ and โ€‹y = \dfrac{-10}{-5} = 2โ€‹. Check: โ€‹2 + 6 = 8โ€‹ and โ€‹1 - 2 = -1โ€‹.

3. The matrix method

If โ€‹|A| \ne 0โ€‹, multiply โ€‹AX = Bโ€‹ on the left by โ€‹A^{-1}โ€‹:

X = A^{-1}B

The order matters: it is โ€‹A^{-1}Bโ€‹, never โ€‹BA^{-1}โ€‹.

For the same system, โ€‹|A| = -5โ€‹ and โ€‹\operatorname{adj} A = \begin{bmatrix} -1 & -3 \\ -1 & 2 \end{bmatrix}โ€‹. So

X = \frac{1}{-5} \begin{bmatrix} -1 & -3 \\ -1 & 2 \end{bmatrix} \begin{bmatrix} 8 \\ -1 \end{bmatrix} = \frac{1}{-5} \begin{bmatrix} -5 \\ -10 \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}

Are Cramer's rule and the matrix method the same? They are two routes to the same answer. Cramer's rule finds each unknown on its own, as a ratio of two determinants. The matrix method finds all the unknowns together, as โ€‹X = A^{-1}Bโ€‹. Since โ€‹A^{-1} = \dfrac{\operatorname{adj} A}{|A|}โ€‹, Cramer's rule is the matrix method written out one unknown at a time. Both need the same thing: the determinant of the coefficients must not be zero.

4. How many solutions?

What you find Number of solutions The system is
โ€‹D \ne 0โ€‹ Exactly one Consistent
โ€‹D = 0โ€‹, and at least one of โ€‹D_1, D_2, D_3โ€‹ is not zero None Inconsistent
โ€‹D = 0โ€‹, and โ€‹D_1 = D_2 = D_3 = 0โ€‹ Infinitely many, or in rare cases none. Look at the equations Usually consistent

An example of the rare case: โ€‹x + y + z = 1โ€‹, โ€‹x + y + z = 2โ€‹, โ€‹x + y + z = 3โ€‹. Every determinant is zero, but the equations contradict each other.

In the matrix method the same test reads: if โ€‹|A| = 0โ€‹, find โ€‹(\operatorname{adj} A)Bโ€‹. If it is not the zero matrix, there is no solution. If it is the zero matrix, there are infinitely many solutions or none.

Two equations in two unknowns have a faster test. For โ€‹a_1x + b_1y = c_1โ€‹ and โ€‹a_2x + b_2y = c_2โ€‹, compare ratios:

Ratios Picture Solutions
โ€‹\dfrac{a_1}{a_2} \ne \dfrac{b_1}{b_2}โ€‹ Two lines that cross Exactly one
โ€‹\dfrac{a_1}{a_2} = \dfrac{b_1}{b_2} \ne \dfrac{c_1}{c_2}โ€‹ Two parallel lines None
โ€‹\dfrac{a_1}{a_2} = \dfrac{b_1}{b_2} = \dfrac{c_1}{c_2}โ€‹ The same line twice Infinitely many

Three graphs: two lines crossing at the point (1, 2), two parallel lines, and two equations that give the same line

The picture shows one system of each kind. On the left, the system of section 1: the lines cross at โ€‹(1, 2)โ€‹, which is its solution. In the middle and on the right, the systems of Example 3 below.

5. Homogeneous systems

A system is homogeneous when every constant on the right is zero: โ€‹AX = Oโ€‹. Then โ€‹x = y = z = 0โ€‹ is always a solution. It is called the trivial solution. So a homogeneous system is always consistent, and the only question is whether it has other solutions:

  • If โ€‹|A| \ne 0โ€‹, the trivial solution is the only one.
  • If โ€‹|A| = 0โ€‹, there are infinitely many solutions, so there are non-zero (non-trivial) ones.

6. Worked examples

Example 1. Solve by Cramer's rule: โ€‹x + y + z = 6โ€‹, โ€‹x - y + z = 2โ€‹, โ€‹2x + y - z = 1โ€‹.

โ€‹D = \begin{vmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 2 & 1 & -1 \end{vmatrix} = 1(1 - 1) - 1(-1 - 2) + 1(1 + 2) = 0 + 3 + 3 = 6โ€‹.

โ€‹D_1 = \begin{vmatrix} 6 & 1 & 1 \\ 2 & -1 & 1 \\ 1 & 1 & -1 \end{vmatrix} = 6(1 - 1) - 1(-2 - 1) + 1(2 + 1) = 6โ€‹.

โ€‹D_2 = \begin{vmatrix} 1 & 6 & 1 \\ 1 & 2 & 1 \\ 2 & 1 & -1 \end{vmatrix} = 1(-2 - 1) - 6(-1 - 2) + 1(1 - 4) = -3 + 18 - 3 = 12โ€‹.

โ€‹D_3 = \begin{vmatrix} 1 & 1 & 6 \\ 1 & -1 & 2 \\ 2 & 1 & 1 \end{vmatrix} = 1(-1 - 2) - 1(1 - 4) + 6(1 + 2) = -3 + 3 + 18 = 18โ€‹.

So โ€‹x = \dfrac{6}{6} = 1โ€‹, โ€‹y = \dfrac{12}{6} = 2โ€‹, โ€‹z = \dfrac{18}{6} = 3โ€‹. Check in the third equation: โ€‹2 + 2 - 3 = 1โ€‹.

Example 2. Solve by the matrix method: โ€‹5x + 2y = 4โ€‹, โ€‹7x + 3y = 5โ€‹.

โ€‹A = \begin{bmatrix} 5 & 2 \\ 7 & 3 \end{bmatrix}โ€‹ and โ€‹|A| = 15 - 14 = 1โ€‹. So โ€‹A^{-1} = \operatorname{adj} A = \begin{bmatrix} 3 & -2 \\ -7 & 5 \end{bmatrix}โ€‹, and

X = A^{-1}B = \begin{bmatrix} 3 & -2 \\ -7 & 5 \end{bmatrix} \begin{bmatrix} 4 \\ 5 \end{bmatrix} = \begin{bmatrix} 12 - 10 \\ -28 + 25 \end{bmatrix} = \begin{bmatrix} 2 \\ -3 \end{bmatrix}

So โ€‹x = 2โ€‹ and โ€‹y = -3โ€‹. Check: โ€‹10 - 6 = 4โ€‹ and โ€‹14 - 9 = 5โ€‹.

Example 3. For what values of โ€‹kโ€‹ does the system โ€‹x + 2y = 3โ€‹, โ€‹2x + ky = 6โ€‹ have (i) exactly one solution, (ii) infinitely many solutions?

โ€‹D = k - 4โ€‹. (i) If โ€‹k \ne 4โ€‹, then โ€‹D \ne 0โ€‹ and there is exactly one solution. (ii) If โ€‹k = 4โ€‹, the ratios are โ€‹\dfrac{1}{2} = \dfrac{2}{4} = \dfrac{3}{6}โ€‹: the second equation is twice the first, so there are infinitely many solutions.

If the second equation were โ€‹2x + 4y = 7โ€‹, the ratios would be โ€‹\dfrac{1}{2} = \dfrac{2}{4} \ne \dfrac{3}{7}โ€‹ and there would be no solution.

Example 4. For what value of โ€‹kโ€‹ does the system โ€‹x + y + z = 0โ€‹, โ€‹x + 2y + 3z = 0โ€‹, โ€‹x + 3y + kz = 0โ€‹ have a non-zero solution?

The system is homogeneous, so we need โ€‹|A| = 0โ€‹:

โ€‹\begin{vmatrix} 1 & 1 & 1 \\ 1 & 2 & 3 \\ 1 & 3 & k \end{vmatrix} = 1(2k - 9) - 1(k - 3) + 1(3 - 2) = k - 5โ€‹.

So โ€‹k = 5โ€‹.

7. From the real papers

Only two real questions are given here. The third question captured on this chapter (NDA II 2025, Q14, on Cramer's rule) has a slip in its printed wording, so practice question 1 below takes its place.

NDA II 2025, Q12. The system of equations โ€‹2x - 3y - 5 = 0โ€‹, โ€‹15y - 10x + 50 = 0โ€‹

(a) has a unique solutionโ€ƒโ€ƒ(b) has infinitely many solutionsโ€ƒโ€ƒ(c) is inconsistentโ€ƒโ€ƒ(d) is consistent and has exactly two solutions

Solution. Write both in the same form: โ€‹2x - 3y = 5โ€‹ and โ€‹-10x + 15y = -50โ€‹. The ratios are โ€‹\dfrac{2}{-10} = \dfrac{-3}{15} = -\dfrac{1}{5}โ€‹, but โ€‹\dfrac{5}{-50} = -\dfrac{1}{10}โ€‹. The first two ratios are equal and the third is different, so the lines are parallel and there is no solution. Answer (c).

NDA II 2026, Q39. If โ€‹x + ay + a^2z = 1โ€‹, โ€‹x + by + b^2z = 1โ€‹, โ€‹x + cy + c^2z = 1โ€‹ where โ€‹a \ne b \ne cโ€‹, then what is โ€‹x + y + zโ€‹ equal to?

(a) โ€‹0โ€‹โ€ƒโ€ƒ(b) โ€‹1โ€‹โ€ƒโ€ƒ(c) โ€‹3โ€‹โ€ƒโ€ƒ(d) โ€‹a + b + cโ€‹

Solution. Try โ€‹x = 1โ€‹, โ€‹y = 0โ€‹, โ€‹z = 0โ€‹: it satisfies all three equations. Is it the only solution? The coefficient determinant is โ€‹\begin{vmatrix} 1 & a & a^2 \\ 1 & b & b^2 \\ 1 & c & c^2 \end{vmatrix} = (a-b)(b-c)(c-a)โ€‹ (Chapter M2-2, Example 3), which is not zero because โ€‹aโ€‹, โ€‹bโ€‹, โ€‹cโ€‹ are different. So the solution is unique, and โ€‹x + y + z = 1โ€‹. Answer (b).

Practice questions in the exam style

These three questions are our own, written in the style of the paper. They are not from a real paper.

Practice 1. The system โ€‹x + y + z = 6โ€‹, โ€‹x + 2y + 3z = 14โ€‹, โ€‹x + 4y + 9z = 36โ€‹ is solved by Cramer's rule. What is the value of the determinant โ€‹D_2โ€‹, which is used to find โ€‹yโ€‹?

(a) 2โ€ƒโ€ƒ(b) 4โ€ƒโ€ƒ(c) 6โ€ƒโ€ƒ(d) 12

Solution. Replace the second column of โ€‹Dโ€‹ by the constants: โ€‹D_2 = \begin{vmatrix} 1 & 6 & 1 \\ 1 & 14 & 3 \\ 1 & 36 & 9 \end{vmatrix} = 1(126 - 108) - 6(9 - 3) + 1(36 - 14) = 18 - 36 + 22 = 4โ€‹. (Here โ€‹D = 2โ€‹, so โ€‹y = \dfrac{4}{2} = 2โ€‹.) Answer (b).

Practice 2. For what value of โ€‹kโ€‹ does the system โ€‹kx + y = 1โ€‹, โ€‹x + ky = 1โ€‹ have no solution?

(a) โ€‹-1โ€‹โ€ƒโ€ƒ(b) โ€‹0โ€‹โ€ƒโ€ƒ(c) โ€‹1โ€‹โ€ƒโ€ƒ(d) โ€‹2โ€‹

Solution. โ€‹D = k^2 - 1โ€‹, which is zero when โ€‹k = 1โ€‹ or โ€‹k = -1โ€‹. For โ€‹k = 1โ€‹ both equations are โ€‹x + y = 1โ€‹: infinitely many solutions. For โ€‹k = -1โ€‹ the equations are โ€‹-x + y = 1โ€‹ and โ€‹x - y = 1โ€‹, that is โ€‹x - y = -1โ€‹ and โ€‹x - y = 1โ€‹: no solution. Answer (a).

Practice 3. If โ€‹A^{-1} = \begin{bmatrix} 1 & -1 \\ 2 & 0 \end{bmatrix}โ€‹ and โ€‹AX = \begin{bmatrix} 3 \\ 1 \end{bmatrix}โ€‹, what is โ€‹Xโ€‹?

(a) โ€‹\begin{bmatrix} 2 \\ 6 \end{bmatrix}โ€‹โ€ƒโ€ƒ(b) โ€‹\begin{bmatrix} 4 \\ 2 \end{bmatrix}โ€‹โ€ƒโ€ƒ(c) โ€‹\begin{bmatrix} 2 \\ 2 \end{bmatrix}โ€‹โ€ƒโ€ƒ(d) โ€‹\begin{bmatrix} 3 \\ 1 \end{bmatrix}โ€‹

Solution. โ€‹X = A^{-1}B = \begin{bmatrix} 3 - 1 \\ 6 + 0 \end{bmatrix} = \begin{bmatrix} 2 \\ 6 \end{bmatrix}โ€‹. Answer (a).

8. Mistakes that cost marks

  1. Turning Cramer's rule upside down. It is โ€‹x = \dfrac{D_1}{D}โ€‹, with โ€‹Dโ€‹ below. Not โ€‹\dfrac{D}{D_1}โ€‹.
  2. Reading the constants with the wrong sign. โ€‹2x - 3y - 5 = 0โ€‹ means โ€‹2x - 3y = 5โ€‹. Move the constant to the right before you write โ€‹Bโ€‹, โ€‹D_1โ€‹, โ€‹D_2โ€‹ or the ratios.
  3. Writing โ€‹X = BA^{-1}โ€‹. The right version is โ€‹X = A^{-1}Bโ€‹. The product โ€‹BA^{-1}โ€‹ is not even defined, because โ€‹Bโ€‹ is a column.
  4. Saying "โ€‹D = 0โ€‹, so there is no solution". โ€‹D = 0โ€‹ only tells you that there is not exactly one solution. There may be none, or infinitely many. Check further.

9. Quick check

Do these without help. Answers are at the end.

  1. Solve by Cramer's rule: โ€‹3x + 2y = 7โ€‹, โ€‹x - y = 4โ€‹.
  2. For what value of โ€‹kโ€‹ does the system โ€‹2x + ky = 5โ€‹, โ€‹3x + 6y = 1โ€‹ not have a unique solution?
  3. How many solutions has the system โ€‹x + 2y = 3โ€‹, โ€‹2x + 4y = 6โ€‹?
  4. For what value of โ€‹kโ€‹ does the system โ€‹x + 2y + 3z = 0โ€‹, โ€‹2x + 3y + z = 0โ€‹, โ€‹3x + 5y + kz = 0โ€‹ have a non-zero solution?
  5. Solve: โ€‹x + y = 5โ€‹, โ€‹y + z = 7โ€‹, โ€‹z + x = 6โ€‹.

10. Read and watch more, free

What Where Language
Textbook, the matrix method NCERT Class 12 Mathematics, Chapter 4 Determinants (the last section) ยท Hindi edition English, Hindi
Self-study notes NIOS Mathematics, Lesson 22 Inverse of a Matrix and its Applications ยท Hindi edition English, Hindi
Textbook, with Cramer's rule OpenStax Algebra and Trigonometry 2e, from section 11.5 onwards English
Video, the whole unit for NDA Defence Wallah: Matrices and Determinants (first video of the playlist, about 5 hours) Hinglish
Video, every textbook problem Magnet Brains: Class 12 Maths, Chapter 4 Hinglish
Video, short lessons Khan Academy India: เคธเคพเคฐเคฃเคฟเค• Hindi

The videos were chosen from their titles, length and views; they have not yet been watched by a teacher.

Answers to the quick check

  1. โ€‹D = -3 - 2 = -5โ€‹, โ€‹D_1 = -7 - 8 = -15โ€‹, โ€‹D_2 = 12 - 7 = 5โ€‹. So โ€‹x = 3โ€‹ and โ€‹y = -1โ€‹.
  2. โ€‹D = 12 - 3k = 0โ€‹, so โ€‹k = 4โ€‹. (Then the ratios are โ€‹\dfrac{2}{3} = \dfrac{4}{6} \ne \dfrac{5}{1}โ€‹, so there is no solution at all.)
  3. Infinitely many: the second equation is twice the first.
  4. โ€‹|A| = 1(3k - 5) - 2(2k - 3) + 3(10 - 9) = 4 - kโ€‹, so โ€‹k = 4โ€‹.
  5. Add the three equations: โ€‹2(x + y + z) = 18โ€‹, so โ€‹x + y + z = 9โ€‹. Then โ€‹z = 9 - 5 = 4โ€‹, โ€‹x = 9 - 7 = 2โ€‹, โ€‹y = 9 - 6 = 3โ€‹.

Next chapter: Angles: degrees and radians.

Free ยท no sign-up

Try three questions on this chapter

Exam-pattern questions from this chapter's drill. Pick an answer for each, then check.

  1. Question 1 of 3
    For what value of โ€‹kโ€‹ does the system โ€‹2x + ky = 7โ€‹, โ€‹6x + 9y = 10โ€‹ have no solution?
  2. Question 2 of 3
    The system โ€‹3x - 2y = 5โ€‹, โ€‹6x - 4y = pโ€‹ has no solution. Which one of the following is correct?
  3. Question 3 of 3
    For what value of โ€‹kโ€‹ does the system โ€‹3x + ky = 4โ€‹, โ€‹6x + 10y = 8โ€‹ have infinitely many solutions?
Free sign-up

You have read the chapter. Now make it stick.

A free account adds the video lesson, a drill of ten questions on this chapter marked like the exam, the timed mock papers, a study plan to your exam date and your own record of what you have done. No fee, no card.

Past questions quoted are from the official UPSC paper named in the text; the explanations are WishWas's own and have been checked against the official key. The links under โ€œRead and watch moreโ€ go to free material on other sites; nothing is copied.