Solve for q:
2 p - 1/q = r/q + 4
Bring 2 p - 1/q together using the common denominator q. Bring r/q + 4 together using the common denominator q:
(2 p q - 1)/q = (4 q + r)/q
Multiply both sides by q:
2 p q - 1 = 4 q + r
Subtract 4 q - 1 from both sides:
q (2 p - 4) = r + 1
Divide both sides by 2 p - 4:
Answer: q = (r + 1)/(2 p - 4)