Hello guys,

I am currently working on a physics paper, and in it there is an equation I need to show how to derive. The equation is (it's not in its original form because it has variables containing two letters, and even though one might say it makes no difference, it actually makes the equation just a bit easier to work with)

where I need to isolate q and express it in terms of all the other variables. So as you may figure out, I used Wolfram|Alpha to help me, and it gave me the following:

I wrote a calculator in Python to verify that this equation does indeed work. If you solve for q knowing the values of all the other variables in the original equation and then plug in that value for q back into the original equation, both sides equal each other. Basically, this derivation is working flawlessly for any values.

The problem is that I need to know the steps to deriving this equation. I have attempted completing the square for this problem twice, each a little differently, but both got me different results. I realize that either I messed up somewhere and I did not notice, or to derive this equation, completing the square does not work. But if you try going backwards from the Wolfram|Alpha solution, it does not look like the result of completing the square.

Is it possible to somehow derive the second equation from the first one showing all the steps, or just figure out a different differentiation that works with steps (because Wolfram|Alpha doesn't want to show me the steps)?