# Solve for U confusion

Hi could someone show me the steps involved in solving for $U_a$ and $U_b$. Also what is this method called. $$x_1 + U_a(x_2 - x_1) = x_3 + U_b(x_4 - x_3)$$ $$y_1 + U_a(y_2 - y_1) = y_3 + U_b(y_4 - y_3)$$

Cheers

Edit : Attept to solve as Karolis suggested

Ok so first I will try and solve for $U_a$

$$x_1 + U_a(x_2 - x_1) = x_3 + U_b(x_4 - x_3)$$ $$U_a(x_2 - x_1) = x_3 - x_1 + U_b(x_4 - x_3)$$ $$U_a = \frac{x_3 - x_1 + U_b(x_4 - x_3)}{(x_2 - x_1)}$$

So now I have $U_a$ I can substitute that in and solve for $U_b$

$$y_1 + U_a(y_2 - y_1) = y_3 + U_b(y_4 - y_3)$$ $$y_1 + \left(\frac{x_3 - x_1 + U_b(x_4 - x_3)}{(x_2 - x_1)}\right)(y_2 - y_1) = y_3 + U_b(y_4 - y_3)$$

Alight so that is substituted. I should be able to solve for $U_b$

$$y_1 + \left(\frac{x_3 - x_1 + U_b(x_4 - x_3)}{(x_2 - x_1)}\right)(y_2 - y_1) = y_3 + U_b(y_4 - y_3)$$

$$\left(\frac{x_3 - x_1 + U_b(x_4 - x_3)}{(x_2 - x_1)}\right)(y_2 - y_1) = y_3 - y_1 + U_b(y_4 - y_3)$$

$$\frac{x_3 - x_1 + U_b(x_4 - x_3)}{(x_2 - x_1)} = \frac{ y_3 - y_1 + U_b(y_4 - y_3)}{ (y_2 - y_1) }$$

$$x_3 - x_1 + U_b(x_4 - x_3) = \frac{ (y_3 - y_1 + U_b(y_4 - y_3))(x_2 - x_1)}{ (y_2 - y_1) }$$

$$(x_3 - x_1 + U_b(x_4 - x_3))(y_2 - y_1) = (y_3 - y_1 + U_b(y_4 - y_3))(x_2 - x_1)$$

$$(x_3 - x_1 + U_bx_4 - U_bx_3)(y_2 - y_1) = (y_3 - y_1 + U_by_4 - U_by_3)(x_2 - x_1)$$

$$x_3(y_2 - y_1) - x_1(y_2 - y_1) + U_bx_4(y_2 - y_1) - U_bx_3(y_2 - y_1) = y_3(x_2 - x_1) - y_1(x_2 - x_1) + U_by_4(x_2 - x_1) - U_by_3(x_2 - x_1)$$

$$U_bx_4(y_2 - y_1) - U_bx_3(y_2 - y_1) = y_3(x_2 - x_1) - y_1(x_2 - x_1) + U_by_4(x_2 - x_1) - U_by_3(x_2 - x_1) - x_3(y_2 - y_1) + x_1(y_2 - y_1)$$

$$U_bx_4(y_2 - y_1) - U_bx_3(y_2 - y_1) + U_by_3(x_2 - x_1) - U_by_4(x_2 - x_1) = y_3(x_2 - x_1) - y_1(x_2 - x_1) - x_3(y_2 - y_1) + x_1(y_2 - y_1)$$

$$U_b\left(x_4(y_2 - y_1) - x_3(y_2 - y_1) + y_3(x_2 - x_1) - y_4(x_2 - x_1)\right) = y_3(x_2 - x_1) - y_1(x_2 - x_1) - x_3(y_2 - y_1) + x_1(y_2 - y_1)$$

$$U_b = \frac{y_3(x_2 - x_1) - y_1(x_2 - x_1) - x_3(y_2 - y_1) + x_1(y_2 - y_1)}{x_4(y_2 - y_1) - x_3(y_2 - y_1) + y_3(x_2 - x_1) - y_4(x_2 - x_1)}$$

Now this solution seems to be correct for $U_b$ but I have seen this can be further simplified to

$$U_b = \frac{(x_2-x_1)(y_1-y_3)-(y_2-y_4)(x_1-x_3)}{(y_4-y_3)(x_2-x_1)-(x_4-x_3)(y_2-y_1)}$$

I have checked my solution against this one and checked both return the same result. My next question is how do I simplify mine to something similar to the above?

Any guidance would be highly appreciated.

-

Solve the first equation for $U_a$, expressing it in terms of $U_b$. Then substitute $U_a$ in the second equation with the expression you found and get an equation with a single variable. Once you've solved that, substitute $U_b$ in the expression of $U_a$ with the solution you got and you are done.
A linear equation is a sum of terms. Some terms have a variable that you want to solve for, some don't. First you move all terms that have a variable to the left, and all other terms to the right. Then you have $c_1 x + c_2 x + ... = d_1 + d_2 + ...$, which, using the distributive property of multiplication becomes $(c_1 + c_2 + ...)x = d_1 + d_2 + ...$. Finally, you divide both sides by the coefficient before the variable and get $x = \frac{d_1 + d_2 + ...}{c_1 + c_2 + ...}$. The procedure is always the same. There is no thinking involved. Good luck.