Math calculator

Adding and Subtracting Polynomials Calculator

The easiest operation in algebra to understand and the easiest to get wrong.

Add or subtract polynomials

The sign flip shown before anything is added.

(3x² + 2x − 5) − (x² − 4x + 1)

2x² + 6x − 6

Degree 2.

Every sign flipped — this is the step that gets missed

−x² + 4x − 1

The minus belongs to the whole bracket, so it reaches the last term as surely as the first. Subtracting only the leading term is the classic slip and gives an answer that looks plausible.

Like terms in columns

Each polynomial’s coefficients aligned by variable part, with the column totals underneath
Polynomialxconstant
3x² + 2x − 532−5
− (x² − 4x + 1)−14−1
total26−6

Every polynomial has a term in every column here, so nothing can slip. The rows below the first are already sign-flipped.

Step by step

  1. 1Write it out(3x² + 2x − 5) − (x² − 4x + 1)Brackets matter here. They are what the operation applies to, and removing them carelessly is the whole difficulty.
  2. 2Flip the sign of EVERY term being subtracted−(x² − 4x + 1) = −x² + 4x − 1Every term, not just the first. This is where the marks go: the minus belongs to the bracket, so it reaches the last term as surely as the first.
  3. 3Remove the brackets3x² + 2x − 5 − x² + 4x − 1Subtraction has become addition of the flipped polynomial. From here it is only collecting.
  4. 4Collect like terms3 , −1 → 2x² 2 , 4 → 6x −5 , −1 → −6Only terms with an identical variable part combine. x²y and xy² are different terms however alike they look.
  5. 5The answer2x² + 6x − 6

Coefficients held as exact fractions, so a term cancels only when it genuinely cancels.

What this tool shows

Nothing here is conceptually hard. Everything here is easy to slip on, and it is the same two slips every time.

  • The subtracted polynomial rewritten with every sign reversed, before anything is added
  • Like terms lined up in columns, with a visible gap where a power is missing
  • Two variables, where x²y and xy² are not like terms however similar they look
  • Terms that cancel completely, reported rather than silently absent
Every sign flipped, shown as its own step Like terms aligned in columns Any number of variables Free, no signup

Free, no signup — exact fractions, nothing rounded.

Updated 6 September 2026 · Works in any browser, no installation

Subtracting a polynomial flips the sign of every term inside the bracket, not just the first. (3x² + 2x − 5) − (x² − 4x + 1) becomes 3x² + 2x − 5 − x² + 4x − 1, which collects to 2x² + 6x − 6. Flipping only the leading term gives 2x² − 2x − 4, which is wrong and looks entirely reasonable.

At a glance

Formula shown
Adding: gather like terms. Subtracting: negate every term of the second polynomial first, then gather. Like terms have identical variable parts, exponents included.
Scenario support
Two to five polynomials, in any number of variables, added or subtracted.
Educational estimate
Planning support from the values you enter — not professional advice.

“Like terms” is a stricter test than it sounds

Two terms combine when their variable parts are identical — same letters, same exponents on each. 3x² and 5x² combine to 8x². 3x² and 5x do not, and neither do 3x²y and 3xy².

The coefficient is the only thing that changes. Adding 3x² and 5x² gives 8x², not 8x⁴: the exponent is part of the identity of the term, not something that accumulates. That is obvious stated plainly and is exactly the slip that appears under time pressure, usually because multiplication (where exponents do add) was practised immediately before.

Adding is then nothing but gathering: (3x² + 2x − 5) + (x² − 4x + 1) = 4x² − 2x − 4, with no sign changes at all. Every difficulty in this operation lives on the subtraction side.

The minus belongs to the whole bracket

(3x² + 2x − 5) − (x² − 4x + 1) is not 3x² + 2x − 5 − x² − 4x + 1. The minus sign in front of the second bracket applies to everything in it, so the bracket becomes −x² + 4x − 1 — all three signs reversed — and only then do the terms gather, to 2x² + 6x − 6.

Distributing the minus over only the first term is the single most common error in polynomial arithmetic, and its symptom is that the answer looks fine. There is no degree mismatch, no obviously wrong coefficient, nothing to notice. The only defence is to write the flipped polynomial as its own line before touching anything else, which is why the calculator gives it a step of its own and a panel of its own.

Once the flip is done there is no subtraction left. What remains is an addition, and additions do not have this failure mode. That is worth saying explicitly because it reframes the operation: subtracting polynomials is one sign change followed by an addition, not a different procedure from adding.

Columns, and the gap you can actually see

Written in a line, a missing power is invisible. 5x³ − 2x + 7 has no x² term at all, and when you subtract 3x³ + x² − 2x from it there is nothing on the page to remind you that one side of that column is empty.

Stacked in columns, that gap is a hole. The tool prints a dash where a polynomial has no term of a given kind, and the dash is doing real work — it says “this is zero” rather than “there is nothing here”, and those read very differently when you are adding down. (5x³ − 2x + 7) − (3x³ + x² − 2x) gives 2x³ − x² + 7, and the x² term in the answer comes entirely from the second polynomial.

It is the same reason long multiplication with digits is written in columns rather than in a line, and the same reason polynomial long division insists on placeholder zeros. Alignment is not decoration in any of these; it is the error-checking.

Two variables, where the test earns its strictness

(2x²y + 3xy²) + (x²y − xy² + 4) = 3x²y + 2xy² + 4. The x²y terms combine with each other and the xy² terms combine with each other, and the two groups have nothing to do with one another — despite both having total degree 3, both containing x and y, and looking almost identical on the page.

This is where “identical variable parts” stops being pedantry. x²y and xy² differ only in which letter carries the square, and combining them is the multivariate version of adding x² to x. The difference is that the single-variable mistake is obvious and this one is not.

A consistent ordering helps more than care does. Writing terms by descending power of the first variable puts anything that could combine next to each other, so the eye is comparing adjacent things rather than scanning. (4a − 3b) + (2a + b) + (a − 5b) = 7a − 7b is trivial in that order and fiddly in any other.

When a term cancels entirely

A column can total zero, and the term simply is not in the answer. (5x³ − 2x + 7) − (3x³ + x² − 2x) loses its x term that way. It is not an error and there is nothing to write — a zero coefficient means the term is absent, not that it is present with value zero.

The extreme case is worth seeing once: (x² + 3x + 2) − (x² + 3x + 2) gives 0, because every column cancels. The answer is the zero polynomial, and that is a complete answer rather than a failure. Two identical polynomials subtract to nothing, exactly as two identical numbers do.

The tool names which terms cancelled rather than letting them vanish, because a term disappearing is worth a second look: sometimes it is the point of the question, and sometimes it means two things were subtracted that should have been added.

Two checks, one of which takes ten seconds

The reliable check is to reverse the operation: add your answer back to what you subtracted, and you should recover the first polynomial. 2x² + 6x − 6 plus x² − 4x + 1 is 3x² + 2x − 5. It is a proof and it takes as long as the original subtraction did.

The fast check is to substitute a number. An identity holds for every value, so put x = 2 into the original expression and into your answer and they must agree. It is not a proof — two expressions can agree at one point by coincidence — but a disagreement is a definite error, and ten seconds to catch a sign slip is a good trade. Pick a value that is not 0 or 1, since those hide too much.

Both checks apply to every operation in this cluster, which is why they are worth building the habit on the easiest one.

Read the guide

This is one of four operations, and they share their checks while failing in different places. Adding, Multiplying and Dividing Polynomials — the Four Operations covers all four together: the sign flip here, the product count that catches a dropped term when multiplying, the placeholder zeros that keep division’s columns honest, and the substitution check that works on all of them.

Sources and methodology

Combining like terms is the distributive law read backwards — 3x² + 5x² is (3 + 5)x² — and is argued above rather than cited. What is cited is the standard reference statement of polynomial algebra.

Method. Every figure on this page comes from src/lib/adding-subtracting-polynomials.ts over the exact-rational term algebra in src/lib/algebra/parse.ts. A term is a coefficient and a map of variable to exponent, so “like terms” is an exact comparison of those maps rather than a string match — which is what makes x²y and xy² reliably different. Columns are ordered by descending degree, including a column that cancelled to nothing and which the answer therefore no longer mentions. That engine is verified on every change against 77 hand-written assertions, including that subtracting a polynomial from itself gives exactly zero and that every column total matches the coefficient in the printed answer. The count and the per-case breakdown are published on the formula verification page.

Related calculators

The other operations:

Multiplying PolynomialsMultiply polynomials of any size in any number of variables, by grid, vertical or term-by-term layout, with the product count that catches a dropped term.
Polynomial DivisionDivide polynomials by long division or synthetic division, with the quotient, the remainder, the remainder theorem check and every stage of the working.
FOILMultiply two binomials with all four products named — First, Outer, Inner, Last — shown as a grid too, with difference of squares and perfect squares recognised.
Factoring TrinomialsFactor a trinomial by the AC method with every factor pair of ac listed, the common factor taken out first, and the answer multiplied back out to check it.
System of EquationsSolve linear systems in up to six unknowns with exact fractions — row operations, the matrix form, Cramer’s rule, and the parametric family when there is no single answer.
ScientificTrigonometry, logarithms, powers, roots, and factorials with correct order of operations, memory registers, history, and keyboard entry.

More in Math, or browse all calculators.

Educational use disclaimer

This calculator adds and subtracts polynomials in any number of variables. Coefficients are held as exact fractions, so a term is reported as cancelling only when it genuinely cancels. It is a study and checking aid: the sign-flip step and the column layout exist because this operation fails on bookkeeping rather than on understanding, and both are there to make the bookkeeping visible.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 6 September 2026

  1. Published the add/subtract polynomials page, built around the sign flip: the subtracted polynomial is rewritten with every sign reversed as its own step, before anything is added.
  2. The column layout prints a dash where a polynomial has no term of that kind, so a missing power is visible rather than silently absent.
  3. Multivariate throughout, because x²y and xy² are not like terms and that is the case the strict definition exists for.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.