Skip to content

Instantly share code, notes, and snippets.

@razzius
Created October 31, 2025 02:18
Show Gist options
  • Select an option

  • Save razzius/1707e9cca470e92c15c44532a7bd67fa to your computer and use it in GitHub Desktop.

Select an option

Save razzius/1707e9cca470e92c15c44532a7bd67fa to your computer and use it in GitHub Desktop.
---
title: Factoring Quadratic Equations Comes Full Circle
---
A student in my math class was having trouble with factoring the following quadratic equation:
$
x^2 -5x + 4
$
She explained that no matter what numbers she tried, it was never working out.
This relates to my experience doing this kind of factoring: at the start, I would just guess numbers (they would never really go outside the range of -6 to 6, and thinking of the ways the constant term would be factored would narrow it down to only a couple options pretty quick),
then eventually, the teachers would start reusing numbers and I'd just remember the answers.
For this one I remember the factorization is:
$
(x - 4)(x - 1)
$
This always struck me as somewhat unsatisfying. The problems would be hand-picked to have nice factoring solutions, but even if we were to be presented with something mildly different, like
$
x^2 - 5.5x + 7.5
$
this approach wouldn't work. This one isn't too bad; I could multiple the whole thing by 2 and recover my whole numbers:
$
2x^2 - 11x + 15
$
then go back to my "I hope I remember the factorization" approach...
This also reminds me how my teachers would generally not us to factor anything
with an x^2 constant other than 1 (this example has a leading coefficient of 2)
since the factoring gets much more difficult.
So when the student asked this today, I brought out the equations of factoring, in the hopes of shedding some light on a general approach.
When factoring an equation of the form
$
x^2 + b x + c
$
The goal is to factor it into the form
$
(x + m)(x + n)
$
where m and n are positive or negative numbers.
Just to review, here's a simple example (and one that I remember seeing dozens of times):
$
x^2 + 5x + 4
$
can be factored as:
$
(x + 4)(x + 1)
$
So back to the equation the student was struggling with:
$
x^2 -5x + 4
$
What I did in the class was expand the polynomial:
$
(x + m)(x + n)
$
$
x^2 + m x + n x + m n
$
$
x^2 + (m + n)x + m n
$
And equate it to the original equation:
$
x^2 + (m + n)x + m n = x^2 -5x + 4
$
This produces a system of equations:
$
m + n = -5\
m times n = 4
$
At this point, the student was able to guess (-4, -1) was the solution.
But I kept going to see if I could get a closed-form solution.
First, I solved for m in the first equation:
$m = -5 -n$
Then I substituted it into the second equation:
$(-5 -n)n = 4$
$-5n -n^2 = 4$
Huh? A quadratic equation! Putting it into standard quadratic form, I get:
$n^2 + 5n + 4 = 0$
Solving _this_ quadratic equation, I get the following 2 answers: -4 and -1.
All of a sudden, the pieces started to click into place. m and n are interchangeable at this point,
and the 2 answers for m and n are -4 and -1.
Arbitrarily assigning m = -4 and n = -1, I can multiply them out to recover the original formula:
$
(x + m)(x + n)
(x - 4)(x - 1)
x^2 -5x +4
$
so I have determined that the factorization of
$x^2 -5x +4$
is:
$(x - 4)(x - 1)$
Which reminded me of one of the reasons you'd want to factor a quadratic equation in the first place: once it's factored, the solutions are whatever x will turn its expression into 0.
x = 4:
$
(4 - 4)(x - 1)\
0 times (...)\
0
$
x = 1:
$
(1 - 4)(1 - 1)\
(...) times 0 \
0
$
So if you can find the answers to a quadratic equation, you can factor it.
To show this, let's use the quadratic formula on the original polynomial:
$
x^2 -5x + 4 => a = 1, b = -5, c = 4.\
(-b plus.minus sqrt(b^2 - 4a c)) / (2a)\
5 plus.minus sqrt(25 - 16) / 2\
(5 + sqrt(9)) / 2,
(5 - sqrt(9)) / 2\
(5 + 3) / 2,
(5 - 3) / 2\
8 / 2,
2 / 2\
4 "and" 1.
$
Knowing these are the roots, I can immediately construct the factored form:
$
(x - 4)(x - 1)
$
Let's use this knowledge to factor a quadratic equation that has noninteger factors:
$
x^2 - 5.5x + 7.5
$
Plugging it in to the quadratic formula yields:
$
3 "and" 2.5.
$
so it can be factored thus:
$
(x - 3)(x - 2.5)
$
Checking my work by multiplying it back out:
$
(x - 3)(x - 2.5)\
x^2 -3x -2.5x + 7.5\
x^2 -5.5x + 7.5
$
Yep!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment