# Nakafa Framework: LLM

URL: /en/subject/high-school/11/mathematics/polynomial/addition-subtraction-polynomial
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/high-school/11/mathematics/polynomial/addition-subtraction-polynomial/en.mdx

Output docs content for large language models.

---

import { LineEquation } from "@repo/design-system/components/contents/line-equation";
import { getColor } from "@repo/design-system/lib/color";

export const metadata = {
  title: "Addition and Subtraction of Polynomials",
  description: "Master polynomial addition and subtraction with step-by-step examples. Learn like terms, horizontal & vertical methods, plus graphical visualization.",
  authors: [{ name: "Nabil Akbarazzima Fatih" }],
  date: "05/04/2025",
  subject: "Polynomial",
};

## Basic Concepts

The operations of addition and subtraction on polynomials are essentially the same as for other algebraic forms: we can only add or subtract **like terms**.

### What Are Like Terms?

**Like terms** are terms that have the **exact same variables and variable powers**. The coefficients of these terms can be different.

**Examples of Like Terms:**

- <InlineMath math="3x, \space -7x, \space -\frac{1}{5}x" /> (all have the variable <InlineMath math="x" /> to
  the power of 1)
- <InlineMath math="\frac{1}{2}x^3, \space 4x^3, \space -2x^3" /> (all have the variable <InlineMath math="x" /> to
  the power of 3)
- <InlineMath math="2x^2yz^3, \space \frac{3}{4}x^2yz^3, \space -5z^3x^2y" /> (all
  have the variable <InlineMath math="x" /> to the power of 2, <InlineMath math="y" /> to
  the power of 1, and <InlineMath math="z" /> to the power of 3)

**Examples of Unlike Terms:**

- <InlineMath math="11x" /> and <InlineMath math="4x^2" /> (different powers of <InlineMath math="x" />
  )
- <InlineMath math="4x^3" /> and <InlineMath math="-2x^4" /> (different powers of <InlineMath math="x" />
  )
- <InlineMath math="4x^2" /> and <InlineMath math="-x^5" /> (different powers of <InlineMath math="x" />
  )
- <InlineMath math="\frac{3}{4}x^2yz^3" /> and <InlineMath math="2x^2y" /> (missing
  the variable <InlineMath math="z^3" />)
- <InlineMath math="\frac{3}{4}x^2yz^3" /> and <InlineMath math="-7xy^2z^3" /> (different
  powers of <InlineMath math="x" /> and <InlineMath math="y" />)

## Polynomial Addition

To add two polynomials, we simply **add the coefficients of like terms**.

**Horizontal Method:**

1.  Write both polynomials in parentheses connected by a plus sign.
2.  Remove the parentheses.
3.  Group the like terms.
4.  Add the coefficients of each group of like terms (use the distributive property).

**Example:**

Find the result of <InlineMath math="(2x^3 + 7x^2 + 3x + 5) + (6x^3 + 2x^2 + 4x + 1)" />.

<div className="flex flex-col gap-4">
  <BlockMath math="(2x^3 + 7x^2 + 3x + 5) + (6x^3 + 2x^2 + 4x + 1)" />
  <BlockMath math="= 2x^3 + 7x^2 + 3x + 5 + 6x^3 + 2x^2 + 4x + 1 \quad \text{(Remove parentheses)}" />
  <BlockMath math="= (2x^3 + 6x^3) + (7x^2 + 2x^2) + (3x + 4x) + (5 + 1) \quad \text{(Group like terms)}" />
  <BlockMath math="= (2 + 6)x^3 + (7 + 2)x^2 + (3 + 4)x + (5 + 1) \quad \text{(Distributive property)}" />
  <BlockMath math="= 8x^3 + 9x^2 + 7x + 6 \quad \text{(Final result)}" />
</div>

## Polynomial Subtraction

To subtract two polynomials, we **change the sign of each term in the polynomial being subtracted**, then add them as usual.

**Horizontal Method:**

1.  Write both polynomials in parentheses connected by a minus sign.
2.  Remove the parentheses. **Remember:** change the sign of each term in the second parenthesis (distribute the negative sign).
3.  Group the like terms.
4.  Add the coefficients of each group of like terms.

**Example:**

Find the result of <InlineMath math="(9x^3 + 4x^2 + 6x + 5) - (2x^3 + 3x^2 + 3x + 4)" />.

<div className="flex flex-col gap-4">
  <BlockMath math="(9x^3 + 4x^2 + 6x + 5) - (2x^3 + 3x^2 + 3x + 4)" />
  <BlockMath math="= 9x^3 + 4x^2 + 6x + 5 - 2x^3 - 3x^2 - 3x - 4 \quad \text{(Change signs \& remove parentheses)}" />
  <BlockMath math="= (9x^3 - 2x^3) + (4x^2 - 3x^2) + (6x - 3x) + (5 - 4) \quad \text{(Group like terms)}" />
  <BlockMath math="= (9 - 2)x^3 + (4 - 3)x^2 + (6 - 3)x + (5 - 4) \quad \text{(Distributive property)}" />
  <BlockMath math="= 7x^3 + 1x^2 + 3x + 1 \quad \text{(Final result)}" />
  <BlockMath math="= 7x^3 + x^2 + 3x + 1" />
</div>

Note: When subtracting, the negative sign in front of the parenthesis changes the sign of _every_ term inside that parenthesis.

## Vertical Method

Besides the horizontal method, polynomial addition and subtraction can also be done using the vertical method, similar to adding and subtracting regular numbers.

**Steps:**

1.  Arrange both polynomials vertically.
2.  Ensure like terms are aligned in the same column.
3.  If a term is missing in one of the polynomials, leave a blank space or write a coefficient of 0.
4.  Add or subtract the coefficients in each column.

**Example of Vertical Addition:**

<BlockMath
  math="\begin{array}{rrrrr}
    & 2x^3 & +7x^2 & +3x & +5 \\
  + & 6x^3 & +2x^2 & +4x & +1 \\
  \hline
    & 8x^3 & +9x^2 & +7x & +6
  \end{array}"
/>

**Example of Vertical Subtraction:**

<BlockMath
  math="\begin{array}{rrrrr}
    & 9x^3 & +4x^2 & +6x & +5 \\
  - & 2x^3 & +3x^2 & +3x & +4 \\
  \hline
    & 7x^3 & +1x^2 & +3x & +1
  \end{array}"
/>

Both methods (horizontal and vertical) will yield the same answer. Choose the method that you find most comfortable and easiest to understand.

## Graphical Addition and Subtraction of Polynomial Functions

Besides performing operations algebraically, we can also understand polynomial addition and subtraction visually through their graphs.

Suppose we have three graphs of polynomial functions:

<div className="flex flex-col gap-4">
  <LineEquation
    title={
      <>
        Graph of <InlineMath math="f(x) = x + 1" />
      </>
    }
    description="Linear Function (Degree 1)"
    showZAxis={false}
    cameraPosition={[0, 0, 15]}
    data={[
      {
        points: Array.from({ length: 51 }, (_, i) => {
          const x = -2.5 + i * 0.1;
          return { x, y: x + 1, z: 0 };
        }),
        color: getColor("SKY"),
        showPoints: false,
      },
    ]}
  />
  <LineEquation
    title={
      <>
        Graph of <InlineMath math="g(x) = 0.5x^4 - 2x^2 + 1" />
      </>
    }
    description="Degree 4 Function"
    showZAxis={false}
    cameraPosition={[0, 0, 15]}
    data={[
      {
        points: Array.from({ length: 51 }, (_, i) => {
          const x = -2.5 + i * 0.1;
          return { x, y: 0.5 * x ** 4 - 2 * x ** 2 + 1, z: 0 };
        }),
        color: getColor("LIME"),
        showPoints: false,
      },
    ]}
  />
  <LineEquation
    title={
      <>
        Graph of <InlineMath math="h(x) = -0.5x^3 + 1.5x" />
      </>
    }
    description="Degree 3 Function"
    showZAxis={false}
    cameraPosition={[0, 0, 15]}
    data={[
      {
        points: Array.from({ length: 51 }, (_, i) => {
          const x = -2.5 + i * 0.1;
          return { x, y: -0.5 * x ** 3 + 1.5 * x, z: 0 };
        }),
        color: getColor("AMBER"),
        showPoints: false,
      },
    ]}
  />
</div>

### Sketching the Graph of the Sum/Difference

Without needing the exact equations of functions <InlineMath math="f" />, <InlineMath math="g" />, or <InlineMath math="h" />, we can sketch the graph of their sum (e.g., <InlineMath math="f(x) + g(x)" />) or difference (e.g., <InlineMath math="f(x) - g(x)" />) as follows:

1.  Choose several identical <InlineMath math="x" /> values on both graphs.
2.  For each <InlineMath math="x" /> value, read the <InlineMath math="y" /> value from each graph. Let <InlineMath math="y_f = f(x)" /> and <InlineMath math="y_g = g(x)" />.
3.  **For addition (<InlineMath math="f(x) + g(x)" />):** Calculate the value <InlineMath math="y_{\text{new}} = y_f + y_g" />.
4.  **For subtraction (<InlineMath math="f(x) - g(x)" />):** Calculate the value <InlineMath math="y_{\text{new}} = y_f - y_g" />.
5.  Plot the point <InlineMath math="(x, y_{\text{new}})" />.
6.  Repeat for several other <InlineMath math="x" /> values.
7.  Connect the new points with a smooth curve.

**Why does this work?**

Because the definition of function addition or subtraction is to add or subtract their output values (<InlineMath math="y" />) for each corresponding input value (<InlineMath math="x" />).

### Example Sketches

Here are example sketches of the graphs resulting from the sum <InlineMath math="f(x) + g(x)" /> and difference <InlineMath math="f(x) - g(x)" />, obtained by vertically adding/subtracting the y-values for each x.

<div className="flex flex-col gap-4">
  <LineEquation
    title={
      <>
        Graph of <InlineMath math="f(x) + g(x)" />,{" "}
        <InlineMath math="f(x) = x + 1" />, and{" "}
        <InlineMath math="g(x) = 0.5x^4 - 2x^2 + 1" />
      </>
    }
    description={
      <>
        The result of <InlineMath math="f(x) + g(x)" /> is{" "}
        <InlineMath math="x + 1 + 0.5x^4 - 2x^2 + 1" />
      </>
    }
    showZAxis={false}
    cameraPosition={[0, 0, 15]}
    data={[
      {
        points: Array.from({ length: 51 }, (_, i) => {
          const x = -2.5 + i * 0.1;
          return { x, y: x + 1 + (0.5 * x ** 4 - 2 * x ** 2 + 1), z: 0 };
        }),
        color: getColor("VIOLET"),
        showPoints: false,
      },
    ]}
  />
  <LineEquation
    title={
      <>
        Graph of <InlineMath math="f(x) - g(x)" />,{" "}
        <InlineMath math="f(x) = x + 1" />, and{" "}
        <InlineMath math="g(x) = 0.5x^4 - 2x^2 + 1" />
      </>
    }
    description={
      <>
        The result of <InlineMath math="f(x) - g(x)" /> is{" "}
        <InlineMath math="x + 1 - (0.5x^4 - 2x^2 + 1)" />
      </>
    }
    showZAxis={false}
    cameraPosition={[0, 0, 15]}
    data={[
      {
        points: Array.from({ length: 51 }, (_, i) => {
          const x = -2.5 + i * 0.1;
          return { x, y: x + 1 - (0.5 * x ** 4 - 2 * x ** 2 + 1), z: 0 };
        }),
        color: getColor("PINK"),
        showPoints: false,
      },
    ]}
  />
</div>

In the same way, you can sketch the graphs of <InlineMath math="f(x) + h(x), \space g(x) + h(x), \space f(x) - h(x), \space \text{and} \space g(x) - h(x)" />. The key is to add or subtract the heights (y-values) of the original graphs at each corresponding x-value.
