Variables and Expressions

Solving for a Variable That Appears Twice

When your target letter shows up in two places, gather the terms, factor it out and divide. Worked examples and traps.

Key takeaways

  • Collect all terms with the target letter on one side and everything else on the other.
  • Factoring turns two appearances of a letter into one, which makes division possible.
  • The factor you divide by cannot be zero, and the zero case deserves its own look.
  • This method works for first-power appearances; a mix of x² and x needs quadratic tools.

When the letter you are solving for appears in two places, you cannot peel it free one operation at a time. First bring every term containing it to the same side, then factor the letter out so that it appears only once, and finally divide by whatever is left beside it.

For instance, in ax = bx + c, subtracting bx gives ax - bx = c. Factoring gives x(a - b) = c, so x = c/(a - b), as long as a and b are different. Every example in this article is a variation on those three moves.

Why ordinary undoing gets stuck

In a formula such as y = 3x + 5, the letter x appears once. You can trace what happens to it, multiply by 3 and then add 5, and reverse that trail.

Now look at y = 3x + kx. Where would you start? Subtracting kx gives y - kx = 3x, and dividing by 3 gives x = (y - kx)/3. That is a true statement, but it has not solved anything, because x still appears on the right. To use it, you would already need to know x.

A formula is solved for x only when x stands alone on one side and is completely absent from the other. Whenever your "answer" mentions the letter it is supposed to define, you have more work to do.

The fix is to notice that 3x and kx share a factor. By the distributive property, 3x + kx = x(3 + k). Now x appears once, and a single division finishes: x = y/(3 + k), provided k ≠ -3.

The method in four moves

  1. Clear obstacles. Multiply away fractions and expand any parentheses that hide the target.
  2. Sort. Move every term containing the target to one side and all other terms to the opposite side.
  3. Factor. Pull the target out as a common factor.
  4. Divide. Divide both sides by the other factor, and state that it is not zero.
When the target letter appears twice
1 Clear Remove fractions and parentheses around it. 2 Sort Target terms on one side, others opposite. 3 Factor Write the target once, times a group. 4 Divide Divide by the group; note when it is zero. Clear Remove fractions and parentheses around it. 1 Sort Target terms on one side, others opposite. 2 Factor Write the target once, times a group. 3 Divide Divide by the group; note when it is zero. 4

The third step is the one that is new. It is the distributive property read from right to left, which is treated at length in factoring out a common factor.

Letters on both sides

Take the general linear equation ax + b = cx + d and solve for x.

ax + b = cx + d
ax - cx = d - b              (sort)
x(a - c) = d - b             (factor)
x = (d - b)/(a - c)          (divide; a ≠ c)

Try it with 7x + 2 = 3x + 14. The formula gives x = 12/4 = 3, and both sides of the equation equal 23.

What if a = c? The equation x(a - c) = d - b becomes 0 = d - b. If d equals b, every number x works. If d differs from b, no number works. So the excluded case is not a technicality; it describes parallel or identical lines. See equations with no solution or infinitely many for the number versions.

You could also have sorted the other way, collecting x on the right. That produces x = (b - d)/(c - a). It looks different, but multiplying the numerator and denominator of one by -1 gives the other.

A plain term hiding as a second appearance

Sometimes one appearance has no visible coefficient. In A = P + Prt, the letter P shows up alone and inside Prt.

A = P + Prt
A = P(1 + rt)                (factor; the lone P becomes 1)
P = A/(1 + rt)               (divide; 1 + rt ≠ 0)

The lone P must leave behind a 1. Writing P(rt) would silently delete a term. You can always check a factorization by multiplying it back out.

The same thing happens with negative signs. In m = n - kn, factoring gives m = n(1 - k), so n = m/(1 - k) when k ≠ 1.

Parentheses and formulas with several pairs

The surface area of a closed rectangular box is S = 2lw + 2lh + 2wh. Solve for the width w. Two of the three terms contain w, so move the third away first.

S = 2lw + 2lh + 2wh
S - 2lh = 2lw + 2wh          (subtract the term without w)
S - 2lh = w(2l + 2h)         (factor)
w = (S - 2lh)/(2l + 2h)      (divide)

For a real box l and h are positive, so the denominator is positive. Test it: with l = 3, w = 4 and h = 5, S = 24 + 30 + 40 = 94. The formula returns (94 - 30)/16 = 4.

If the target is inside parentheses, expand before sorting. For 5(x - a) = b(x + 2), expanding gives 5x - 5a = bx + 2b. Then 5x - bx = 5a + 2b, and x = (5a + 2b)/(5 - b), with b ≠ 5.

Fractions with the letter above and below

A very common textbook and exam situation is y = (2x + 3)/(x - 1), to be solved for x.

y = (2x + 3)/(x - 1)         (x ≠ 1)
y(x - 1) = 2x + 3            (multiply by the denominator)
yx - y = 2x + 3              (expand)
yx - 2x = y + 3              (sort)
x(y - 2) = y + 3             (factor)
x = (y + 3)/(y - 2)          (divide; y ≠ 2)

Check with x = 4. Then y = 11/3, and (11/3 + 3)/(11/3 - 2) equals (20/3)/(5/3), which is 4.

The restriction y ≠ 2 is honest. Setting (2x + 3)/(x - 1) equal to 2 leads to 2x + 3 = 2x - 2, which is impossible, so the original expression never produces 2. This calculation is exactly how you find the inverse of such a function.

A science example

The voltage across one of two resistors in series, in a simple circuit model, can be written v = Vr/(r + R), where V is the supply voltage and r and R are the resistances. Suppose you want r, which appears on top and on the bottom.

v(r + R) = Vr
vr + vR = Vr
vR = Vr - vr
vR = r(V - v)
r = vR/(V - v)               (V ≠ v)

With made-up values V = 12, R = 200 and v = 4, you get r = 800/8 = 100. Back in the original, 12 × 100/300 = 4.

The result also makes physical sense. As v gets closer to V, the denominator shrinks and the required r grows very large. Treat this as an algebra exercise; any hands-on electrical work needs proper supervision and safe low-voltage equipment.

Seeing a group as the thing that repeats

Sometimes what appears twice is not a single letter but a whole expression. In k(x + 1) - 4 = m(x + 1), the group x + 1 occurs on both sides. You could expand everything, but it is quicker to treat the group as one object.

k(x + 1) - 4 = m(x + 1)
k(x + 1) - m(x + 1) = 4          (sort)
(x + 1)(k - m) = 4               (factor out the group)
x + 1 = 4/(k - m)                (divide; k ≠ m)
x = 4/(k - m) - 1

With k = 5, m = 3, this gives x = 4/2 - 1 = 1. Checking the original: 5(2) - 4 = 6 and 3(2) = 6.

The same shortcut helps with subscripted or compound terms in science formulas. If a temperature difference such as T - T₀ occurs twice, solve for the difference first and add T₀ at the very end. Fewer symbols on the page means fewer places to drop a sign.

Be sure the two groups really are identical. The expressions x - 1 and 1 - x are opposites, not equal, so you must rewrite 1 - x as -(x - 1) before factoring them together.

When factoring is not enough

The method relies on every appearance being to the first power, so that the letter is a common factor leaving no copy behind. Compare these cases.

Equation in x Appearances Tool
px + qx = s x and x Factor, then divide
x² + px = s x² and x Complete the square or use the quadratic formula
x²p - x²q = s x² twice Factor out x², then take square roots
x + √x = s x and √x Substitute u = √x, giving a quadratic

In the second row, factoring gives x(x + p) = s, but x is still inside the parentheses, so you have not reduced to one appearance. The third row works because both terms carry the same power: x²(p - q) = s, so x² = s/(p - q), and x = ±√(s/(p - q)) when that quotient is not negative.

Mistakes worth avoiding

Dividing too early. From ax = bx + c, dividing by x gives a = b + c/x. This assumes x ≠ 0 and does not isolate x efficiently. Sorting and factoring is cleaner and safer. The danger of dividing by the unknown is explained in why dividing by a variable can lose solutions.

Combining unlike coefficients. The sum ax + bx is (a + b)x. It is not abx and not 2abx.

Losing a sign while moving terms. Subtracting -kx from a side means adding kx to the other. Write the operation next to each line.

Cancelling across addition. In (y + 3)/(y - 2), the y terms do not cancel.

Forgetting to test. Pick numbers, compute the other quantity, and run your formula backward. Choose values that avoid 0 and 1 so that errors cannot hide.

A short set to try

  1. Solve kx - 4 = x + m for x.
  2. Solve t = (u + 2)/(u - 5) for u.
  3. Solve W = 3n + pn - 7 for n.

For the first, kx - x = m + 4, so x = (m + 4)/(k - 1) with k ≠ 1. For the second, tu - 5t = u + 2, then u(t - 1) = 5t + 2, so u = (5t + 2)/(t - 1) with t ≠ 1. For the third, W + 7 = n(3 + p), so n = (W + 7)/(3 + p) with p ≠ -3.

If these feel routine, you are ready for any rearrangement in which the target stays at the first power.

Written for 4Algebra with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 35 articles in Variables and Expressions →

Latest news on this topic