Start by labeling each equation so that it'll make it easier to work with. We should also note that

are constants

Now we have two equations and we want to solve for the constant

and

. So we can use one of two methods to solve the simultaneous equations, either substitution or elimination. For the sake of it lets pick the elimination method.
Now we want to multiply each equation by something that will give us two equations, of which the coefficient on the

or the

are the same for both. That will then allow us to subtract or add one equation from the other to 'eliminate' one of the variables.
Lets start by trying to eliminate

, since the two coefficients of

for each equation are different and not factors of each other, the lowest common multiple will be

, so to get this in equation [1] we need to multiply equation [1] by

and multiply equation [2] by

.

Now since we have the same

term in both we are able to take one equation from the other, so we'll take equation [4] from equation [3].
y & =qa-pb<br />\\ y & =\frac{bp-aq}{a^{2}+b^{2}}<br />\end{alignedat})
Now that we have the required expression for

we can substitute this back into the first equation to find

.
 & =p<br />\\ ax & =p-b\left(\frac{bp-aq}{a^{2}+b^{2}}\right)<br />\\ ax & =\frac{a^{2}p+b^{2}p-b^{2}p+abq}{a^{2}+b^{2}}<br />\\ ax & =\frac{a\left(ap+bq\right)}{a^{2}+b^{2}}<br />\\ x & =\frac{ap+bq}{a^{2}+b^{2}}<br />\end{alignedat})
For the substitution method we want to firstly rearrange one of the equations to get either

or

, then 'substitute' this expression into the other equation to find an expression for the other variable not in terms of the first variable. Then finally we substitute the expression for the second variable back into the first equation we rearranged to get the first variable in terms of no other variables.
So firstly rearranging one of the equations to get

in terms of

.

Next substituting that expression we found into the other equation, here that is the second equation. Then we rearrange the expression for the other variable, so here that is

.
-ay & =q<br />\\ \frac{bp-b^{2}y-a^{2}y}{a} & =q<br />\\ -y\left(a^{2}+b^{2}\right) & =aq-bp<br />\\ y & =-\left(\frac{aq-bp}{a^{2}-b^{2}}\right)<br />\\ \implies y & =\frac{bp-aq}{a^{2}+b^{2}}<br />\end{alignedat})
Now finally we substitute this expression back into our first rearranged equation to find

.
}{}<br />\\ & =\frac{\left(a^{2}p+b^{2}p-b^{2}p+abq\right)}{a^{2}+b^{2}}\div a<br />\\ & =\frac{a\left(ap+bq\right)}{a^{2}+b^{2}}\times\frac{1}{a}<br />\\ & =\frac{ap+bq}{a^{2}+b^{2}}<br />\end{alignedat})