c program for linear equation in 2 variables

linear equation in 2 variables
by elimination and subtitution
both method…??? efficient nd less memory consuming
wats d diffrence btw these two approach …???

difference between efficient and less memory consuming : time-efficient is about what it’s execution time is, space-efficient (or less memory consuming) is how less space it takes.

Eg: representing graph edges in adjacency list is space efficient, but access takes more time (have to check in whole list); while adjacency matrix is time efficient (O(1) time), but takes O(n*n) space

1 Like

You can easily find the solution of these equations by cross multiplication:

a1x + b1y + c1 =0 …(1)

a2x + b2y + c2 =0 …(2)

cross multiplication

x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1)

y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1)

1 Like

substitution will take less space as there is no requirment of extra variable(in code) but it will be slow as include more calculation like divede multiply etc…

//