# Equating coefficients

In mathematics, the method of equating the coefficients is a way of solving a functional equation of two expressions such as polynomials for a number of unknown parameters. It relies on the fact that two expressions are identical precisely when corresponding coefficients are equal for each different type of term. The method is used to bring formulas into a desired form.

## Example in real fractions

Suppose we want to apply partial fraction decomposition to the expression:
    ${\frac {1}{x(x-1)(x-2)}},\,$
that is, we want to bring it into the form:
    ${\frac {A}{x}}+{\frac {B}{x-1}}+{\frac {C}{x-2}},\,$
in which the unknown parameters are A, B and C. Multiplying these formulas by x(x − 1)(x − 2) turns both into polynomials, which we equate:
    $A(x-1)(x-2)+Bx(x-2)+Cx(x-1)=1,\,$
or, after expansion and collecting terms with equal powers of x:
    $(A+B+C)x^{2}-(3A+2B+C)x+2A=1.\,$
At this point it is essential to realize that the polynomial 1 is in fact equal to the polynomial 0x$^2$ + 0x + 1, having zero coefficients for the positive powers of x. Equating the corresponding coefficients now results in this system of linear equations:
    $A+B+C=0,\,$
    $3A+2B+C=0,\,$
    $2A=1.\,$
Solving it results in:
    $A={\frac {1}{2}},\,B=-1,\,C={\frac {1}{2}}.\,$

## Example in nested radicals

A similar problem, involving equating like terms rather than coefficients of like terms, arises if we wish to de-nest the nested radicals ${\sqrt {a+b{\sqrt {c}}\ }}$ to obtain an equivalent expression not involving a square root of an expression itself involving a square root, we can postulate the existence of rational parameters d, e such that
    ${\sqrt {a+b{\sqrt {c}}\ }}={\sqrt {d}}+{\sqrt {e}}.$
Squaring both sides of this equation yields:
    $a+b{\sqrt {c}}=d+e+2{\sqrt {de}}.$
To find d and e we equate the terms not involving square roots, so $a=d+e,$ and equate the parts involving radicals, so $b{\sqrt {c}}=2{\sqrt {de}}$ which when squared implies $b^{2}c=4de.$ This gives us two equations, one quadratic and one linear, in the desired parameters d and e, and these can be solved to obtain
    $e={\frac {a+{\sqrt {a^{2}-b^{2}c}}}{2}},$
    $d={\frac {a-{\sqrt {a^{2}-b^{2}c}}}{2}},$
which is a valid solution pair if and only if ${\sqrt {a^{2}-b^{2}c}}$ is a rational number.

## Example of testing for linear dependence of equations

Consider this overdetermined system of equations (with 3 equations in just 2 unknowns):
    $x-2y+1=0,$
    $3x+5y-8=0,$
    $4x+3y-7=0.$
To test whether the third equation is linearly dependent on the first two, postulate two parameters a and b such that a times the first equation plus b times the second equation equals the third equation. Since this always holds for the right sides, all of which are 0, we merely need to require it to hold for the left sides as well:
    $a(x-2y+1)+b(3x+5y-8)=4x+3y-7.$
Equating the coefficients of x on both sides, equating the coefficients of y on both sides, and equating the constants on both sides gives the following system in the desired parameters a, b:
    $a+3b=4,$
    $-2a+5b=3,$
    $a-8b=-7.$
Solving it gives:
    $a=1,\ b=1$
The unique pair of values a, b satisfying the first two equations is (a, b) = (1, 1); since these values also satisfy the third equation, there do in fact exist a, b such that a times the original first equation plus b times the original second equation equals the original third equation; we conclude that the third equation is linearly dependent on the first two.
Note that if the constant term in the original third equation had been anything other than –7, the values (a, b) = (1, 1) that satisfied the first two equations in the parameters would not have satisfied the third one (a – 8b = constant), so there would exist no a, b satisfying all three equations in the parameters, and therefore the third original equation would be independent of the first two.

## Example in complex numbers

The method of equating coefficients is often used when dealing with complex numbers. For example, to divide the complex number a+bi by the complex number c+di, we postulate that the ratio equals the complex number e+fi, and we wish to find the values of the parameters e and f for which this is true. We write
    ${\frac {a+bi}{c+di}}=e+fi,$
and multiply both sides by the denominator to obtain
    $(ce-fd)+(ed+cf)i=a+bi.$
Equating real terms gives
    $ce-fd=a,$
and equating coefficients of the imaginary unit i gives
    $ed+cf=b.$
These are two equations in the unknown parameters e and f, and they can be solved to obtain the desired coefficients of the quotient:
    $e={\frac {ac+bd}{c^{2}+d^{2}}}\quad \quad {\text{and}}\quad \quad f={\frac {bc-ad}{c^{2}+d^{2}}}.$