Start with
[tex]u=p-2x+ay[/tex]
Move all terms not involving [tex]a[/tex] to the left, i.e. add [tex]2x-p[/tex] to both sides:
[tex]u-p+2x=ay[/tex]
Divide both sides by [tex]y[/tex]. To do so, we must assume [tex]y\neq 0[/tex]
[tex]\dfrac{u-p+2x}{y}=a[/tex]
And we have solved the equation for a:
[tex]a=\dfrac{u-p+2x}{y}[/tex]