Rearranging Equations#
Rearranging equations is changing the arrangement of terms in an equation. Consider the ideal gas equation, \(pV=nRT\). We could rearrange the equation so that we have \(T\) in terms of the other variables, so in this case \(T = \frac{pV}{nR}\). This rearranging is called making \(T\) the subject of the formula. When rearranging, we perform operations to both sides of the equation, so we may:
Add or subtract the same quantity to or from both sides.
Multiply or divide both sides by the same quantity.
Order To Do Rearrangements#
BODMAS is used to decide which operations we should undo to make our quantity the subject. It is used in reverse, so the operations are undone in the following order:
Subtraction/Addition
Multiplication/Division
Orders
Brackets
Equations of Motion
An ion is moving through a magnetic field. After a time, \(t\), the ion’s velocity has increased from \(u\) to \(v\). The acceleration is \(a\) and is described by the equation \(v=u=+at\). Rearrange the equation to make \(a\) the subject.
Solution: We identify the operations in use are + and ×. Then we undo (or invert) each of the operations. Remember that we can do anything as long as we do it on both side of the = sign.
We start by undoing the addition as we go in the order of BODMAS backwards. On the right hand side, we have \(u\) being added to the term involving \(a\). We then invert the operation by doing the opposite and subtracting \(u\) from both sides of the equation. So
We can now see that the only other operation acting on our \(a\) is multiplication, which we undo by dividing both side of the equation by \(t\):
We now have made \(a\) the subject of this equation.
We can use the sympy
library to double check our rearrangement.
from sympy import symbols, Eq, solve
v, u, a, t = symbols('v, u, a, t')
eq = Eq(u + a * t, v)
solve(eq, a)
[(-u + v)/t]
Gibbs Equation
In thermodynamics, the Gibbs equation, \(\Delta G\), dictates whether a reaction is feasible at the temperature, \(T\). \(\Delta S\) and \(\Delta H\) are the entropy and enthalpy changes for the reaction. They are all related by the following equation:
Rearrange this equation to make \(\Delta S\) the subject.
Solution: The first step is to under the subtraction on the right hand side by adding \(t\Delta S\) to each side. This produces the equation:
The next step would be to undo the addition by subtracting \(\Delta G\) from both sides to get the term involving \(\Delta S\) on its own. Doing this step gives:
This leaves only the multiplication to be dealt with, which is undone by dividing by \(T\) to give the equation for \(\Delta S\) to be:
With Python.
Delta_G, Delta_H, T, Delta_S = symbols('Delta_G, Delta_H, T, Delta_S')
eq = Eq(Delta_G, Delta_H - T * Delta_S)
solve(eq, Delta_S)
[(-Delta_G + Delta_H)/T]
Rearranging with Power and Roots#
The inverse operations of powers are roots, so to reverse a power, we take a root and vice versa. We complete rearrangement in reverse order of BODMAS, therefore, we rearrange powers and roots in the orders section.
Mass-Energy Equivalence
Einstein’s equation for mass-energy equivalence is often seen in the form:
Express it with \(c\) being the subject.
Solution: To start with, we should divide each side of the equation by \(m\).
Now \(c\) is raised to the power of 2. To undo this operation, we take the square root of both sides.
E, m, c = symbols('E, m, c')
eq = Eq(E, m * c**2)
solve(eq, c)
[-sqrt(E/m), sqrt(E/m)]
Naturely, we would use the one with the positive sign as a negative speed is not really logical.
Example
Solve the following:
Given \(px + a = qx + b\), make \(x\) the subject of the formula.
Given \(\frac{\sqrt{t} + 2}{y} = y make \)t$ the subject of the equation.
Make \(P\) the subject of the equation \(x(1+P)^2 = \frac{4}{x}\).
Solution:
We have an \(x\) on both sides of the equation \(px+a=qx+b\), so we need to collect these together
First by subtracting \(qx\) from both sides: \(px+a-qx = qx + b-qx\)
Then factorise and simplify: \(x(p-q)+a = b\)
Subtract \(a\) from both sides: \(x(p-q) + a - a = b - a\)
Now simplify: \(x(p-q) = b-a\)
Divide both sides by \((p-q)\): \(x = \frac{b-a}{p-q}\)
We notice that the only \(t\) is on the top of the fraction and underneath a square root.
The first step would be to multiple both sides by \(y\): \(\sqrt{t}+2 = y^2\)
Take away 2 from both sides: \(\sqrt{t} = y^2 - 2\)
Square both sides to remove the root: \(t = (y^2-2)^2\)
The \(P\) is inside a bracket, which is being squared and multiplied.
The first step would be divide both sides by \(x\): \((1+P)^2 = \frac{4}{x^2}\)
Take the square root of both sides: \(1+P = \sqrt{\frac{4}{x^2}}\)
This square root can be simplified down, since the numerator and denominator are both squares: \(1+P = \frac{2}{x}\)
Subtract 1 from both sides: \(P = \frac{2}{x}-1\).
With sympy
these are all rather simple to perform.
p, q, x, a, b = symbols('p q x a b')
eq = Eq(p * x + a, q * x + b)
solve(eq, x)
[(-a + b)/(p - q)]
from sympy import sqrt
t, y = symbols('t y')
eq = Eq((sqrt(t) + 2) / y, y)
solve(eq, t)
[(y**2 - 2)**2]
P, x = symbols('P x')
eq = Eq(x * (1 + P) ** 2, 4 / x)
solve(eq, P)
[(2 - x)/x, (-x - 2)/x]