Solve for x
and y
.
\begin{align*}
expr(["+", ["*", A1, "x"], ["*", B1, "y"]]) &= C1 \\
expr(["+", ["*", A2, "x"], ["*", B2, "y"]]) &= C2
\end{align*}
x
= X_NUMER2 / X_DENOM2
y
= Y_NUMER / Y_DENOM
One way to solve this system of equations is to use elimination.
In order to eliminate \blue{x}
, we need to make its coefficient in one equation equal to
the negative of its coefficient for the other equation.
In order to eliminate \green{y}
, we need to make its coefficient in one equation equal to
the negative of its coefficient for the other equation.
\begin{align*}
\blue{expr(["*", A1, "x"])} +
\green{expr(["*", B1, "y"])} &= C1 \\
\blue{expr(["*", A2, "x"])} +
\green{expr(["*", B2, "y"])} &= C2
\end{align*}
Multiply the top equation by MULT_A
and the bottom equation by MULT_B
.
\begin{align*}
\blue{expr(["*", A1 * MULT_A, "x"])} +
\green{expr(["*", B1 * MULT_A, "y"])} &= C1 * MULT_A \\
\blue{expr(["*", A2 * MULT_B, "x"])} +
\green{expr(["*", B2 * MULT_B, "y"])} &= C2 * MULT_B
\end{align*}
Add the top and bottom equations.
\green{expr(["*", Y_DENOM1, "y"])} = Y_NUMER1
Divide both sides by Y_DENOM1
and simplify.
\green{y = fractionReduce(Y_NUMER, Y_DENOM)}
Substitute \green{fractionReduce(Y_NUMER, Y_DENOM)}
for \green{y}
in the top equation.
\blue{expr(["*", A1, "x"])} +
\green{B1}(\green{fractionReduce(Y_NUMER, Y_DENOM)}) = C1
\blue{expr(["*", A1, "x"])} +
fractionReduce(B1 * Y_NUMER, Y_DENOM) = C1
\blue{expr(["*", A1, "x"])} = fractionReduce(C1 * Y_DENOM - B1 * Y_NUMER, Y_DENOM)
\blue{x = fractionReduce(X_NUMER, X_DENOM)}
The solution is \blue{x = fractionReduce(X_NUMER, X_DENOM)}, \enspace
\green{y = fractionReduce(Y_NUMER, Y_DENOM)}
.
Add the top and bottom equations.
\blue{expr(["*", X_DENOM2, "x"])} = X_NUMER2
Divide both sides by X_DENOM2
and simplify.
\blue{x = fractionReduce(X_NUMER2, X_DENOM2)}
Substitute \blue{fractionReduce(X_NUMER2, X_DENOM2)}
for \blue{x}
in the top equation.
\blue{A1}(\blue{fractionReduce(X_NUMER2, X_DENOM2)}) +
\green{expr(["*", B1, "y"])} = C1
fractionReduce(A1 * X_NUMER2, X_DENOM2) +
\green{expr(["*", B1, "y"])} = C1
\green{expr(["*", B1, "y"])} = fractionReduce(C1 * X_DENOM2 - A1 * X_NUMER2, X_DENOM2)
\green{y = fractionReduce(Y_NUMER, Y_DENOM)}
The solution is \blue{x = fractionReduce(X_NUMER2, X_DENOM2)}, \enspace
\green{y = fractionReduce(Y_NUMER, Y_DENOM)}
.
Solve for x
and y
.
\begin{align*}expr(["+", ["*", A1, "x"], ["*", B1, "y"]]) &= C1 \\
expr(["+", ["*", A2, "x"], ["*", B2, "y"]]) &= C2\end{align*}
x
= X_NUMER / X_DENOM
y
= Y_NUMER / Y_DENOM
One way to solve this system of equations is by deriving an expression for y
from the second equation,
and substituting it back into the first equation.
Begin by subtracting expr(["*", A2, "x"])
from both sides of the second equation.
expr(["*", B2, "y"]) = \blue{expr(["+", ["*", -A2, "x"], C2])}
Divide both sides by B2
to isolate y
.
y = \blue{SIGN_1decimalFraction( -A2 / B2, "true", "true" )x + decimalFraction( C2 / B2, "true", "true" )}
Substitute this expression for y
in the first equation.
expr(["*", A1, "x"])B1_SIGNabs( B1 )(\blue{SIGN_1decimalFraction( -A2 / B2, "true", "true" )x + decimalFraction( C2 / B2, "true", "true" )}) = C1
expr(["*", A1, "x"]) + SIGN_2decimalFraction( -A2 / B2 * B1, "true", "true" )x + decimalFraction( C2 / B2 * B1, "true", "true" ) = C1
Simplify by combining terms, then solve for x
.
decimalFraction( A1 + ( -A2 / B2 * B1 ), "true", "true" )x + decimalFraction( C2 / B2 * B1, "true", "true" ) = C1
decimalFraction( A1 + ( -A2 / B2 * B1 ), "true", "true" )x = decimalFraction( C1 - ( C2 / B2 * B1 ), "true", "true" )
x = fractionReduce( X_NUMER, X_DENOM )
Substitute fractionReduce( X_NUMER, X_DENOM )
for x
back into the top equation.
expr(["+", ["*", A1, " " + fractionReduce( X_NUMER, X_DENOM )], ["*", B1, "y"]]) = C1
expr(["+", fractionReduce( A1 * X_NUMER, X_DENOM ), ["*", B1, "y"]]) = C1
expr(["*", B1, "y"]) = fractionReduce( C1 * X_DENOM - A1 * X_NUMER, X_DENOM )
y = fractionReduce(Y_NUMER, Y_DENOM)
The solution is x = fractionReduce(X_NUMER, X_DENOM), \enspace y = fractionReduce(Y_NUMER, Y_DENOM)
.
Solve for x
and y
.
\begin{align*}expr(["+", ["*", A1, "x"], ["*", B1, "y"]]) &= C1 \\
expr(["+", ["*", A2, "x"], ["*", B2, "y"]]) &= C2\end{align*}
x
= X_NUMER / X_DENOM
y
= Y_NUMER / Y_DENOM
One way to solve this system of equations is by deriving an expression for x
from the second equation,
and substituting it back into the first equation.
Begin by subtracting expr(["*", B2, "y"])
from both sides of the second equation.
expr(["*", A2, "x"]) = \blue{
expr(["+", ["*", -B2, "y"], C2])}
Divide both sides by A2
to isolate x
.
x = \blue{SIGN_1decimalFraction( -B2 / A2, "true", "true" )y + decimalFraction( C2 / A2, "true", "true" )}
Substitute this expression for x
in the first equation.
A1_SIGNabs( A1 )(\blue{SIGN_1decimalFraction( -B2 / A2, "true", "true" )y + decimalFraction( C2 / A2, "true", "true" )}) + expr(["*", B1, "y"]) = C1
SIGN_2decimalFraction( -B2 / A2 * A1, "true", "true" )y + decimalFraction( C2 / A2 * A1, "true", "true" ) + expr(["*", B1, "y"]) = C1
Simplify by combining terms, then solve for y
.
decimalFraction( B1 + ( -B2 / A2 * A1 ), "true", "true" )y + decimalFraction( C2 / A2 * A1, "true", "true" ) = C1
decimalFraction( B1 + ( -B2 / A2 * A1 ), "true", "true" )y = decimalFraction( C1 - ( C2 / A2 * A1 ), "true", "true" )
y = fractionReduce(Y_NUMER, Y_DENOM)
Substitute fractionReduce( Y_NUMER, Y_DENOM )
for y
in the top equation.
expr(["+", ["*", A1, "x"], ["*", B1, " " + fractionReduce( Y_NUMER, Y_DENOM )]]) = C1
expr(["+", ["*", A1, "x"], fractionReduce( B1 * Y_NUMER, Y_DENOM )]) = C1
expr(["*", A1, "x"]) = fractionReduce(C1 * Y_DENOM - B1 * Y_NUMER, Y_DENOM)
x = fractionReduce(X_NUMER, X_DENOM)
The solution is x = fractionReduce(X_NUMER, X_DENOM),\enspace y = fractionReduce(Y_NUMER, Y_DENOM)
.