Free algebra calculator with perfect square steps

Perfect Square Trinomial Calculator

Use this perfect square trinomial calculator to check whether a quadratic trinomial is a perfect square, factor it as a squared binomial, expand \((px+q)^2\), or find the missing middle term. The calculator shows the formula, verifies the condition, and explains every step using properly rendered MathJax notation.

A perfect square trinomial is a trinomial that comes from squaring a binomial. The two main patterns are \((a+b)^2=a^2+2ab+b^2\) and \((a-b)^2=a^2-2ab+b^2\). In quadratic form, this means a trinomial like \(x^2+10x+25\) can be factored as \((x+5)^2\).

Calculate a perfect square trinomial

Choose a mode. You can check \(Ax^2+Bx+C\), expand a squared binomial \((px+q)^2\), or find the missing middle term that makes \(Ax^2+Bx+C\) a perfect square trinomial.

Result
Choose a mode and press calculate.
Main test: \(B^2=4AC\), with \(A\ge0\) and \(C\ge0\), for a real perfect square trinomial.
This section includes a working calculator, MathJax rendering, inline CSS, inline JavaScript, HowTo schema, FAQPage schema, and calculator schema.

What is a perfect square trinomial?

A perfect square trinomial is a three-term polynomial that can be written as the square of a binomial. In simple language, it is what you get when you multiply a binomial by itself. For example, \((x+5)^2\) means \((x+5)(x+5)\). When expanded, it becomes \(x^2+10x+25\). Because the trinomial came from a squared binomial, \(x^2+10x+25\) is a perfect square trinomial.

The word “perfect square” means the expression has a square root that is another algebraic expression. Just as \(25\) is a perfect square because \(25=5^2\), the trinomial \(x^2+10x+25\) is a perfect square because \(x^2+10x+25=(x+5)^2\). This idea is important in factoring, solving quadratic equations, completing the square, graphing parabolas, and simplifying algebraic expressions.

The most common perfect square trinomial patterns are \(a^2+2ab+b^2\) and \(a^2-2ab+b^2\). The first pattern factors as \((a+b)^2\). The second pattern factors as \((a-b)^2\). The first and last terms must be perfect squares, and the middle term must be twice the product of the square roots of the first and last terms.

Main perfect square trinomial formulas

\[ (a+b)^2=a^2+2ab+b^2 \] \[ (a-b)^2=a^2-2ab+b^2 \]

In quadratic form:

\[ Ax^2+Bx+C=(px+q)^2 \] when \[ A=p^2,\quad B=2pq,\quad C=q^2 \]

How to use the perfect square trinomial calculator

The calculator has three modes. The first mode checks a trinomial in the form \(Ax^2+Bx+C\). Enter the coefficient \(A\), the coefficient \(B\), and the constant \(C\). The calculator tests whether the trinomial can be written as \((px+q)^2\). It uses the condition \(B^2=4AC\) and also checks that \(A\) and \(C\) are nonnegative for a real squared binomial.

The second mode expands a squared binomial. Enter \(p\) and \(q\) for \((px+q)^2\). The calculator expands the expression into \(p^2x^2+2pqx+q^2\). This mode is useful when your teacher asks you to expand a binomial square or when you want to verify that a factorization is correct.

The third mode finds the missing middle term. If you know the first term and the last term of a perfect square trinomial, the middle term must be \(+2\sqrt{AC}x\) or \(-2\sqrt{AC}x\). For example, \(x^2+Bx+36\) becomes a perfect square when \(B=12\) or \(B=-12\), giving \(x^2+12x+36=(x+6)^2\) or \(x^2-12x+36=(x-6)^2\).

Step-by-step process

  1. Write the trinomial in standard form: \(Ax^2+Bx+C\).
  2. Check whether the first term \(Ax^2\) is a square term.
  3. Check whether the last term \(C\) is a square term.
  4. Compute \(2\sqrt{A}\sqrt{C}\).
  5. Compare the result with the middle coefficient \(B\).
  6. If \(B=2\sqrt{A}\sqrt{C}\), factor as \((\sqrt{A}x+\sqrt{C})^2\).
  7. If \(B=-2\sqrt{A}\sqrt{C}\), factor as \((\sqrt{A}x-\sqrt{C})^2\).
  8. If neither condition works, the trinomial is not a perfect square trinomial.

The perfect square trinomial test

For a trinomial \(Ax^2+Bx+C\), the fastest test is \(B^2=4AC\). This test comes from the square of a binomial. If \(Ax^2+Bx+C=(px+q)^2\), then expanding the right side gives \(p^2x^2+2pqx+q^2\). That means \(A=p^2\), \(B=2pq\), and \(C=q^2\). Squaring \(B=2pq\) gives \(B^2=4p^2q^2\). Since \(p^2=A\) and \(q^2=C\), the condition becomes \(B^2=4AC\).

This condition is also connected to the discriminant of a quadratic. The discriminant is \(B^2-4AC\). A perfect square trinomial has \(B^2-4AC=0\), which means the quadratic has one repeated root. This is why the graph of a perfect square quadratic touches the \(x\)-axis at exactly one point when it is set equal to zero. For example, \(x^2-6x+9=(x-3)^2\), and the equation \(x^2-6x+9=0\) has the repeated solution \(x=3\).

The test \(B^2=4AC\) is useful because it works even when coefficients are not simple integers. However, in many school-level factoring problems, teachers expect the square roots of \(A\) and \(C\) to be clean integers. For example, \(9x^2+30x+25\) is perfect because \(9x^2=(3x)^2\), \(25=5^2\), and \(30x=2(3x)(5)\). The factored form is \((3x+5)^2\).

Perfect square test

\[ Ax^2+Bx+C \text{ is a perfect square if } B^2=4AC \] and it can be written as \[ Ax^2+Bx+C=(\sqrt{A}x+\operatorname{sign}(B)\sqrt{C})^2 \] when \(A\ge0\) and \(C\ge0\).

Worked examples

Example 1: Factor \(x^2+10x+25\)

Start with the trinomial \(x^2+10x+25\). The first term \(x^2\) is a square because \(x^2=(x)^2\). The last term \(25\) is a square because \(25=5^2\). Now check the middle term. Twice the product of \(x\) and \(5\) is \(2(x)(5)=10x\), which matches the middle term.

\[ x^2+10x+25=x^2+2(x)(5)+5^2 \] \[ x^2+10x+25=(x+5)^2 \]

The trinomial is a perfect square trinomial, and the factored form is \((x+5)^2\). The sign is positive because the middle term is positive.

Example 2: Factor \(4x^2-12x+9\)

Here, \(4x^2=(2x)^2\), and \(9=3^2\). The middle term should be twice the product of \(2x\) and \(3\), with the correct sign. Since \(2(2x)(3)=12x\) and the middle term is \(-12x\), the binomial uses subtraction.

\[ 4x^2-12x+9=(2x)^2-2(2x)(3)+3^2 \] \[ 4x^2-12x+9=(2x-3)^2 \]

The factored form is \((2x-3)^2\). Notice that the last term is still positive. In a squared binomial, the last term is positive because \((-3)^2=9\).

Example 3: Check \(9x^2+30x+25\)

The first term \(9x^2\) is \((3x)^2\), and the last term \(25\) is \(5^2\). The expected middle term is \(2(3x)(5)=30x\), which matches the trinomial exactly.

\[ 9x^2+30x+25=(3x)^2+2(3x)(5)+5^2 \] \[ 9x^2+30x+25=(3x+5)^2 \]

The trinomial is perfect. This example also shows that the leading coefficient does not have to be \(1\). As long as the first term and last term are squares and the middle term follows the \(2ab\) rule, the trinomial is a perfect square.

Example 4: A trinomial that is not a perfect square

Consider \(x^2+7x+12\). The first term \(x^2\) is a square, but the last term \(12\) is not a perfect square integer. Even if we use the discriminant test, \(B^2=49\) and \(4AC=4(1)(12)=48\), so \(B^2\ne4AC\).

\[ B^2=7^2=49 \] \[ 4AC=4(1)(12)=48 \] \[ 49\ne48 \]

Therefore, \(x^2+7x+12\) is not a perfect square trinomial. It can still be factored as \((x+3)(x+4)\), but it is not the square of one binomial.

Example 5: Find the missing middle term

Find \(B\) so that \(9x^2+Bx+25\) is a perfect square trinomial. The first term is \(9x^2=(3x)^2\), and the last term is \(25=5^2\). The middle coefficient must be positive or negative \(2(3)(5)\).

\[ B=\pm2\sqrt{9}\sqrt{25} \] \[ B=\pm2(3)(5)=\pm30 \] So: \[ 9x^2+30x+25=(3x+5)^2 \] \[ 9x^2-30x+25=(3x-5)^2 \]

The missing middle coefficient can be \(30\) or \(-30\). Both choices create a perfect square trinomial, but they factor with different signs.

Positive and negative perfect square trinomials

A perfect square trinomial can have a positive middle term or a negative middle term. When the middle term is positive, the factored binomial has a plus sign. When the middle term is negative, the factored binomial has a minus sign. The first and last terms remain positive in both cases because squares are nonnegative.

For example, \(x^2+8x+16=(x+4)^2\), while \(x^2-8x+16=(x-4)^2\). The first term \(x^2\) and the last term \(16\) are the same in both trinomials. Only the middle term changes sign. This happens because the middle term comes from \(2ab\) in the plus case and \(-2ab\) in the minus case.

This sign rule helps students avoid a common mistake. The trinomial \(x^2-8x-16\) is not a perfect square trinomial because the last term is negative. A squared binomial such as \((x-4)^2\) produces \(x^2-8x+16\), not \(x^2-8x-16\). If the last term is negative, the expression cannot be the square of a real binomial in the usual school algebra sense.

Pattern Expanded form Factored form Middle term sign
Square of a sum \(a^2+2ab+b^2\) \((a+b)^2\) Positive
Square of a difference \(a^2-2ab+b^2\) \((a-b)^2\) Negative
Quadratic form \(Ax^2+Bx+C\) \((px+q)^2\) Depends on \(q\)

Perfect square trinomials and completing the square

Perfect square trinomials are central to completing the square. Completing the square is a method for rewriting a quadratic expression as a squared binomial plus or minus a constant. It is used to solve quadratic equations, derive the quadratic formula, convert quadratics into vertex form, and understand the graph of a parabola.

For a simple expression \(x^2+Bx\), the value that completes the square is \(\left(\frac{B}{2}\right)^2\). For example, to complete the square for \(x^2+10x\), take half of \(10\), which is \(5\), and square it to get \(25\). Then \(x^2+10x+25=(x+5)^2\). This is exactly the perfect square trinomial pattern.

Completing the square is not just a factoring trick. It changes the structure of a quadratic so the vertex and transformations are easier to see. For example, \(x^2+6x+5\) can be rewritten as \((x+3)^2-4\). The expression \((x+3)^2\) comes from completing the square, while the \(-4\) adjusts the value so the expression remains equivalent.

Completing the square rule

\[ x^2+Bx+\left(\frac{B}{2}\right)^2 = \left(x+\frac{B}{2}\right)^2 \]

For example:

\[ x^2+10x+25=(x+5)^2 \]

How perfect square trinomials connect to quadratics

Every perfect square trinomial is a quadratic expression with a repeated factor. For example, \(x^2-6x+9=(x-3)^2\). If you set this equal to zero, you get \((x-3)^2=0\), so \(x=3\). The solution is repeated because both factors are the same: \((x-3)(x-3)\). This is why the discriminant is zero for a perfect square trinomial.

On a graph, a perfect square quadratic such as \(y=(x-3)^2\) touches the \(x\)-axis at the vertex instead of crossing it. The vertex is the point where the squared expression becomes zero. Since a square is never negative, the graph stays on one side of the \(x\)-axis when the leading coefficient is positive.

This connection helps students understand why perfect square trinomials matter beyond factoring worksheets. They appear in vertex form, optimization problems, quadratic equations, transformations, and algebraic proofs. Recognizing the pattern quickly can simplify many problems.

Common mistakes with perfect square trinomials

The first common mistake is checking only the first and last terms. A trinomial is not automatically a perfect square just because the first and last terms are squares. For example, \(x^2+8x+9\) has square first and last terms, but it is not a perfect square trinomial because the middle term does not equal \(2(x)(3)=6x\).

The second common mistake is forgetting the middle term when expanding. Students sometimes write \((x+5)^2=x^2+25\). This is incorrect because \((x+5)^2\) means \((x+5)(x+5)\), which expands to \(x^2+10x+25\). The middle term \(10x\) comes from two products: \(5x\) and \(5x\).

The third common mistake is using the wrong sign. The expression \((x-7)^2\) expands to \(x^2-14x+49\), not \(x^2+14x+49\). The sign of the middle term depends on the sign inside the binomial. The last term stays positive because \((-7)^2=49\).

The fourth common mistake is confusing a perfect square trinomial with the difference of squares. The expression \(x^2-25\) is a difference of squares, not a perfect square trinomial. It factors as \((x-5)(x+5)\), not as \((x-5)^2\). A perfect square trinomial has three terms, while a difference of squares usually has two terms.

The fifth common mistake is ignoring the coefficient of \(x^2\). For \(4x^2+20x+25\), the square root of \(4x^2\) is \(2x\), not \(x\). The correct factorization is \((2x+5)^2\), because \(2(2x)(5)=20x\). Treating the leading coefficient carefully is essential.

Practice problems

Use these problems to practice recognizing and factoring perfect square trinomials. After solving them by hand, use the calculator to check your work.

  1. Factor \(x^2+12x+36\).
  2. Factor \(x^2-18x+81\).
  3. Factor \(4x^2+28x+49\).
  4. Factor \(25x^2-40x+16\).
  5. Determine whether \(x^2+9x+16\) is a perfect square trinomial.
  6. Find the missing middle term in \(16x^2+Bx+81\).

Answers: \(1)\ (x+6)^2\). \(2)\ (x-9)^2\). \(3)\ (2x+7)^2\). \(4)\ (5x-4)^2\). \(5)\ Not a perfect square trinomial because \(9^2\ne4(1)(16)\). \(6)\ B=\pm72\), so the trinomials are \(16x^2+72x+81\) and \(16x^2-72x+81\).

Perfect square trinomial FAQs

What is a perfect square trinomial?

A perfect square trinomial is a three-term polynomial that can be written as the square of a binomial, such as \(x^2+10x+25=(x+5)^2\).

What is the formula for a perfect square trinomial?

The two main formulas are \((a+b)^2=a^2+2ab+b^2\) and \((a-b)^2=a^2-2ab+b^2\).

How do I know if a trinomial is a perfect square?

Check whether the first and last terms are squares and whether the middle term is twice the product of their square roots. In quadratic form, check whether \(B^2=4AC\).

Can the middle term be negative?

Yes. A negative middle term comes from the square of a difference, such as \((x-4)^2=x^2-8x+16\).

Is \(x^2-25\) a perfect square trinomial?

No. \(x^2-25\) is a difference of squares, not a trinomial. It factors as \((x-5)(x+5)\).

What is the missing term in \(x^2+Bx+49\)?

The missing middle coefficient is \(B=\pm14\), so the perfect square trinomials are \(x^2+14x+49=(x+7)^2\) and \(x^2-14x+49=(x-7)^2\).

Related Num8ers resources

Perfect square trinomials connect to multiplying binomials, polynomial multiplication, factoring, completing the square, and quadratic equations. Use these related Num8ers resources to support students as they move to the next skill.