# Subtracting Polynomials

## Related Calculator: Polynomial Calculator

Subtraction of** polynomials** is quite similar to addition of polynomials. You just need to be careful with minus sign.

Similarly to adding, we can subtract polynomials either horizontally or vertically.

**Example 1**. Simplify `(9x+3y)-(3x-7y)` (parenthesis are written to separate polynomials).

*Horizontally*.

First, we need to get rid of minus sign in front of parenthesis. This can be done using distributive property of multiplication: `9x+3y-1*(3x)-1*(-7y)`.

Note, that I wrote 1 to show distributive property `a(b+c)=ab+ac` explicitly. In above case `a=-1`, `b=3x` and `c=-7y`.

Now, we just perform multiplication and simplification: `9x+3y-1*(3x)-1*(-7y)=9x+3y-3x+7y=6x+10y`.

*Vertically*.

$$$\begin{array}{r} \ & 9\color{blue}{x}&+&3\color{green}{y}&\phantom{)} \\- ( & 3\color{blue}{x}&-&7\color{green}{y}&) \\ \hline \end{array}$$$

Probably. you've already noticed that running negative sign through parenthesis changes sign of each term inside parenthesis.

This means, that we can write, that `(9x+3y)-(3x-7y)=(9x+3y)color(red)(+)(color(red)(-)3xcolor(red)(+)7y)`.

Thus, that instead of writing minus sign, we can discard minus sign and swap signs.

Then, we can perform addition:

$$$\begin{array}{r} \ & 9\color{blue}{x}&+&3\color{green}{y}\\\color{red}{-} & 3\color{blue}{x}&\color{red}{+}&7\color{green}{y} \\ \hline \ & 6\color{blue}{x}&+&10\color{green}{y}\end{array}$$$

Thus is `(9x+3y)-(3x-7y)=6x+10y`.

**Rule for subtracting polynomials**: change signs of terms of a polynomial that is subtracted. Perform addition instead of subtraction.

Sometimes, there are some terms in one polynomial, that can be absent in another. In this case, for vertical subtraction, you need to correctly line up polynomials and leave gaps, where needed.

Also, terms in polynomials can be written in different order. When subtracting vertically, write like terms one under another.

**Example 2**. Simplify `(3x^4+5x^3+1)-(2x^4-5-9x^2)`.

*Horizontally*.

Change signs: `(3x^4+5x^3+1)-(2x^4-5-9x^2)=(3x^4+5x^3+1)+(-2x^4+5+9x^2)`.

Now, add polynomials:

`3x^4+5x^3+1-2x^4+5+9x^2=x^4+5x^3+9x^2+6`.

*Vertically*.

Remember to line up correctly.

$$$\begin{array}{r} \ & 3x^4&+&5x^3&\phantom{+}&\phantom{9x^2}&+&1 \\ - &2x^4&\phantom{+}&\phantom{5x^3}&+&9x^2&+&5 \\ \hline & x^4&+&5x^3&+&9x^2&+&6 \\ \end{array}$$$

Therefore, `(3x^4+5x^3+1)-(2x^4-5-9x^2)=x^4+5x^3+9x^2+6`.

Finally, you can add/subtract more than 2 polynomials.

**Example 3**. Perform subtraction: `(7x^2-2xy+3y^2-1)-(6x^2+2xy-3)-(2xy-5y^2+x^2-3)`.

*Horizontally*.

Change signs: `7x^2-2xy+3y^2-1-6x^2-2xy+3-2xy+5y^2-x^2+3`.

Now, perform addition: `7x^2-2xy+3y^2-1-6x^2-2xy+3-2xy+5y^2-x^2+3=-6xy+8y^2+5`.

*Vertically*. Don't forget to write like terms under each other and fill gaps, where necessary.

$$$\begin{array}{r} \ & 7x^2&-&2xy&+&3y^2&-&1 \\ -& 6x^2&-&2xy&\phantom{+}&\phantom{3y^2}&+&3 \\- &x^2&-&2xy&+&5y^2&+&3 \\ \hline & &-&6xy&+&8y^2&+&5 \\ \end{array}$$$

**Answer**: `(7x^2-2xy+3y^2-1)-(6x^2+2xy-3)-(2xy-5y^2+x^2-3)=-6xy+8y^2+5`.

Now, it is time to exercise.

**Exercise 1**. Simplify `(3x^2-2xy+5y^2)-(-2y^2-3x^2+5xy)`.

**Answer**: `6x^2-7xy+7y^2`.

**Exercise 2**. Perform subtraction: `(5+2x^3)-(x^2-4-5x^3+x)`.

**Answer**: `7x^3-x^2-x+9`.

**Exercise 3**. Simplify `(-xy^2+4x^2y^2-5x^3)-(7x^2y^2-x^3-6x^2y)+(4x^3-8x^2y^2)`.

**Answer**: `-11x^2y^2+6x^2y-xy^2`.