What this calculator does
This tool solves a system of two simultaneous linear equations in two unknowns, x and y, of the form \(a_1\cdot x + b_1\cdot y = c_1\) and \(a_2\cdot x + b_2\cdot y = c_2\). It applies Cramer's rule, which is mathematically identical to LU decomposition with partial pivoting for a 2×2 system. This is pure mathematics and works the same everywhere.
How to use it
Enter the six real numbers that define your two equations: the coefficients of x (a1, a2), the coefficients of y (b1, b2), and the right-hand-side constants (c1, c2). Coefficients may be negative, decimal, or zero. Click calculate to get the unique values of x and y, plus the determinant as a diagnostic.
The formula explained
First compute the determinant of the coefficient matrix: \(D = a_1\cdot b_2 - a_2\cdot b_1\). Then form two further determinants by replacing a column with the constants: \(D_x = c_1\cdot b_2 - c_2\cdot b_1\) and \(D_y = a_1\cdot c_2 - a_2\cdot c_1\). The unique solution is $$ x = \frac{D_x}{D}, \qquad y = \frac{D_y}{D} \\[1.5em] \text{where}\quad \left\{ \begin{aligned} D &= a_1\,b_2 - a_2\,b_1 \\ D_x &= c_1\,b_2 - c_2\,b_1 \\ D_y &= a_1\,c_2 - a_2\,c_1 \end{aligned} \right. $$ If \(D = 0\) the system has no unique solution: when \(D_x\) and \(D_y\) are also zero the equations are the same line (infinitely many solutions); otherwise the lines are parallel and distinct (no solution).
Worked example
Solve \(1\cdot x + 2\cdot y = 3\) and \(4\cdot x + 5\cdot y = 6\). Then $$ D = (1\cdot 5) - (4\cdot 2) = -3, \quad D_x = (3\cdot 5) - (6\cdot 2) = 3, \quad D_y = (1\cdot 6) - (4\cdot 3) = -6. $$ So \(x = 3 / {-3} = -1\) and \(y = -6 / {-3} = 2\). Check: \(1(-1) + 2(2) = 3\) and \(4(-1) + 5(2) = 6\). Correct.
FAQ
What if the determinant is zero? There is no single (x, y) pair. The calculator reports either "no solution" (parallel lines) or "infinitely many solutions" (the same line).
Can a coefficient be zero? Yes. A zero coefficient simply means that variable is absent from that equation; the solver still works as long as the determinant is non-zero.
Does it accept decimals and negatives? Yes, all six inputs are treated as ordinary real numbers.