2 × 2 linear system

Calculate 2 × 2 linear system using the values and assumptions you provide.

Calculate 2 × 2 linear system using the values and assumptions you provide.

Both dots and commas are accepted as decimal separators.

Your inputs stay in your browser. Displayed results are rounded to a maximum of 12 significant digits.

Method and assumptions

Method version 1.0.0 · Updated

Calculate

Formula: Cramer’s rule for a pair of linear equations

Calculate 2 × 2 linear system using the values and assumptions you provide.

a
Coefficient a
b
Coefficient b
e
Coefficient e
c
Coefficient c
d
Coefficient d
f
Coefficient f

Results depend on the assumptions entered; verify professional or safety-critical decisions independently.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const [a,b,c,d,e,f] = [2,1,1,-1,5,1]; // 2x+y=5; x-y=1
const det = a*d-b*c;
console.log((e*d-b*f)/det, (a*f-e*c)/det); // x=2, y=1
TypeScript
const [a,b,c,d,e,f] = [2,1,1,-1,5,1];
const det = a*d-b*c;
const x: number = (e*d-b*f)/det, y: number = (a*f-e*c)/det;
console.log(x,y); // 2, 1
Python
a,b,c,d,e,f = 2,1,1,-1,5,1
det = a*d-b*c
print((e*d-b*f)/det, (a*f-e*c)/det)  # x=2, y=1
Java
double a=2,b=1,c=1,d=-1,e=5,f=1,det=a*d-b*c;
System.out.println((e*d-b*f)/det + ", " + (a*f-e*c)/det); // x=2,y=1
C#
double a=2,b=1,c=1,d=-1,e=5,f=1,det=a*d-b*c;
Console.WriteLine($"x={(e*d-b*f)/det}, y={(a*f-e*c)/det}"); // 2, 1