Discriminant is the unique invariant of $\text{SL}_2\mathbb{Z}$ acting on polynomials. The following is a really wonderful theorem that I really have no idea how to prove.
Consider $p=ax^2+bxy+cy^2$, and let $\text{SL}_2\mathbb{Z}$ act on all such $p$ by $\begin{pmatrix}
 a&b \\ 
 c&d 
\end{pmatrix}:x^i y^j \mapsto(ax+cy)^i (bx+dy)^j$ extended linearly.
Let $f(a(p),b(p),c(p))$ be a polynomial, where $a(p)$ is the coefficient of $x^2$ in $p$. $\text{SL}_2\mathbb{Z}$ acts on all such polynomials in $a,b,c$, call these polynomials $P$, by an extension of its action on $p$.
Prove that if $h \in P$ is fixed by all of $\text{SL}_2\mathbb{Z}$ then $h$ is a polynomial in $\text{disc}(p)=b^2-4ac.$
(See about 3:30 here).
 A: The proofs in Hilbert's Theory of Algebraic Invariants and Olver's Classical Invariant Theory require a fair amount of background reading to get to; nonetheless, I think it's possible to prove this result directly as follows. I am not sure whether the following proof generalizes to compute the ring of invariants of any other $n$-ary $k$-ic forms.
Recall that $\mathrm{SL}_2(\mathbb{Z})$ is generated by the matrix $\left[\begin{array}{cc} 0 & -1 \\ 1 & 0 \end{array}\right]$ together with the collection of matrices $\left[\begin{array}{cc} 1 & n \\ 0 & 1 \end{array}\right]$ for positive integers $n$, so a polynomial $f \in \mathbb{Z}[a,b,c]$ is invariant under the $\mathrm{SL}_2(\mathbb{Z})$ action if and only if it's invariant under the action of these generators, which is equivalent to saying that
$$(1) \quad f(a,b,c) = f(c,-b,a) \quad \text{and} \quad (2) \quad f(a,b,c) = f(a + nb + n^2c, b + 2nc, c) \text{ for all $n > 0$}.$$
Viewing $f$ as a polynomial in $b$ with coefficients in $\mathbb{Z}[a,c]$, condition $(1)$ above implies that the coefficient of $b^k$ is a symmetric polynomial in $a,c$ if $k$ is even and an antisymmetric polynomial in $a,c$ if $k$ is odd.
To show that $f$ is a polynomial in $4ac - b^2$, we claim it suffices to show that the residue of $f$ modulo the ideal $(4ac-b^2) \subset \mathbb{Z}[a,b,c]$ is equal to a constant. For then $f = C + g \cdot (4ac - b^2)$ for some $C \in \mathbb{Z}$ and $g \in \mathbb{Z}[a,b,c]$ with $\deg g < \deg f$; observing that $g$ is also invariant under the $\mathrm{SL}_2(\mathbb{Z})$ action and inducting on degree proves the claim.
Let's now work in the quotient ring $R = \mathbb{Z}[a,b,c]/(4ac-b^2)$. We can think of the relation $4ac - b^2 = 0$ as giving us a way to write higher powers of $b$ in terms of $b^0$ and $b^1$; i.e., every time we encounter $b^{2k}$ (respectively, $b^{2k-1}$) for some $k > 0$, we replace it with $(ac)^{k}$ (respectively, $(ac)^{k-1} \cdot b$). Combining our results thus far, we see that the residue of $f$ in $R$ may be expressed as
$$f = f_1 \cdot b^0 + f_2 \cdot b^1,$$
where $f_1 \in \mathbb{Z}[a,c]$ is symmetric and $f_2 \in \mathbb{Z}[a,c]$ is antisymmetric. The transformations $(1)$ and $(2)$ defined above are degree-preserving, so by splitting each $f_i$ up into its homogeneous-degree pieces (each of which satisfies the same symmetry properties as $f_i$), it suffices to treat the case where $f_1$ is of homogeneous degree $k > 0$ and $f_2$ is of homogeneous degree $k-1$. We take this to be the case in what follows.
Suppose $k > 0$, and view $f_1, f_2$ as polynomials in $a$. We claim that the degree of $f_1$ as a polynomial in $a$ (denoted $\deg_a f_1$) is strictly greater than the degree of $f_2$ as a polynomial in $a$ (denoted $\deg_a f_2$). To prove this claim, we need some notation. Let $\deg_a f_1 = i$ and $\deg_a f_2 = j$, and let the coefficients of the leading terms in $f_1$ and $f_2$ respectively be $\gamma_1 \cdot c^{k-i}$ and $\gamma_2 \cdot c^{k-1-j}$ for nonzero $\gamma_1, \gamma_2 \in \mathbb{Z}$. Note that $f$ is invariant under the action of transformations of the type $(2)$ defined above. If $j > i$, then the degree of the image of $f_1$ under a type $(2)$ transformation is equal to $j \neq i$, contradicting invariance. If $j = i$, then the leading term of the image of $f_1$ under a type $(2)$ transformation is equal to $(\gamma_1 + 2n\gamma_2) \cdot c^{k-i} \neq \gamma_1 \cdot c^{k-i}$, again contradicting invariance. Thus, $j < i$, so the claim is true.
Now notice that the coefficient of $c^k$ in the image of $f_1$ under a type $(2)$ transformation is a sum of two pieces: one coming from applying the transformation to $f_1$ and the other coming from applying the transformation to $f_2 \cdot b$. The piece coming from $f_1$ is a polynomial of degree $2i$ in $n$, whereas the piece coming from $f_2 \cdot b$ is a polynomial of degree $2j+1$ in $n$. Since $j < i$, we have that $2j + 1 < 2i$, so the coefficient of $c^k$ in the image of $f_1$ is a polynomial of degree $2i$ in $n$. This is not possible, because the coefficient of $a^k$ in the image of $f_1$ is a constant, and the image of $f_1$ is symmetric under the interchange $a \leftrightarrow c$.
From the above contradiction, we deduce that $\deg f_1 = k \not > 0$, so $f_1$ must be a constant and $f_2$ must be zero. Thus, the residue of $f$ in $R$ is a constant, implying the desired result.
