The idea of a discriminant is that it encodes information about the roots of a polynomial and allows us to get at it without actually finding those roots which can be very difficult in the general case.
Let's look at quadratic polynomials. We want a quick calculation which will tell us how many distinct roots it has and if those roots are real or complex. The general quadratic polynomial is
ax2 + bx + c = 0
But we are only interested in knowing where it's zero and so we can multiply it by a constant because the result will still be zero and no new zeros will be introduced. In this case, we use 1/a, to get (Eqn 1)
x2 + (b/a)x + c/a = 0
On the other hand, we know that if r1 and r2 are the roots, then the above factors as
(x - r1)(x - r2)
and multiplying it out, we get (Eqn 2)
x2 - (r1 + r2)x + r1r2
So we can look at (Eqn 1) and (Eqn 2) and equate their coefficients:
b/a = - (r1 + r2)
c/a = r1r2
Now, we're trying to find a way to "cheat" and know stuff about the roots without actually finding them. Consider the difference r1 - r2. If the two roots are the same, then it will be zero. If the two roots are complex, then we know that they're of the form s + it, s - it and the result will be 2it which is pure imaginary. If the roots are both real, then the difference will be non-zero (either positive or negative). That's sort of messy. If we squared it, then any non-zero real (i.e., two distinct real roots) would square to a positive, zero (i.e., one real root, repeated twice) would square to zero and a pure imaginary (i.e. a pair of complex conjugates) would square to a negative number. This would be much nicer. So that's one indication that we want to shoot for an expression that's equal to
(r1 - r2)2
Another indication is that if we look at our expressions for b/a and c/a, we see that one is degree 1 in the roots and the other is degree 2 in the roots. So let's square b/a to get
(b/a)2 = r12 + r22 + 2r1r2
Which is degree 2.
Now let's expand out our target to get
(r1 - r2)2 = r12 + r22 - 2r1r2
But r12 + r22 = (b/a)2 - 2(c/a) and 2r1r2 = 2(c/a) so we get
(r1 - r2)2 = [(b/a)2 - 2(c/a)] - 2(c/a) = (b/a)2 - 4(c/a)
So we're pretty much done. The one annoying thing is that we'll have to square a and do division. But if we multiply both sides by a2, then we won't change the sign and so won't lose any information We write the discriminant of f(x) = ax2 + bx + c as d(f). Then we get
d(f) = a2(r1 - r2)2 = b2 - 4ac
It's true that we could have read that off of the quadratic equation (which is how it's normally introduced) but that doesn't generalize degrees higher than four. This method of finding it will work for any degree.