# How do you make basic substitutions in Mathematica? [duplicate]

I have an equation:

e == m*c^2 + (1/2)*c^2*m*v^2


$$e==m c^2 + \frac{1}{2}c^2\space m\space v^2$$

I need to remove the $$v$$ variable and replace it with $$p$$. I also know that $$p=m\space v$$. If I multiply the second expression of this equation by $$m/m$$, I can get:

$$e==m c^2 + \frac{1}{2}\frac{c^2\space m^2\space v^2}{m}$$And then I can make the substitution $$p=mv$$ to get: $$e==m c^2 + \frac{1}{2}\frac{c^2\space p^2}{m}$$ How do I make force Mathematica to make this substitution for me?

• /. v -> p/m ? – Szabolcs Mar 20 at 20:01
• Now that I see it, it looks simple. Thank you. – Quarkly Mar 20 at 20:04