Factor a bivariate polynomial treating one variable as constant
Although there might be various approaches, it seems that proceeding the most obvious one should be good enough
We have
Collect[(x^2 - f[k]) (x^2 - g[k]) // Expand, x]
x^4 + x^2 (-f[k] - g[k]) + f[k] g[k]
on the other hand it should be identically equal to
Collect[4096 - 20480 k^2 + 16384 k^4 - 128 x^2 - 320 k^2 x^2 + x^4, x]
4096 - 20480 k^2 + 16384 k^4 + (-128 - 320 k^2) x^2 + x^4
Therefore equating appropriate coefficients in the both polynomials we get a simple system and solving it yields solutions
Solve[{-128 - 320 k^2 == -f[k] - g[k],
4096 - 20480 k^2 + 16384 k^4 == f[k] g[k]}, {f[k], g[k]}]
{{f[k] -> 32 (2 + 5 k^2 - Sqrt[40 k^2 + 9 k^4]), g[k] -> 32 (2 + 5 k^2 + Sqrt[k^2 (40 + 9 k^2)])}, {f[k] -> 32 (2 + 5 k^2 + Sqrt[40 k^2 + 9 k^4]), g[k] -> 32 (2 + 5 k^2 - Sqrt[k^2 (40 + 9 k^2)])}}
Another, and a slightly simpler approach would be:
Solve[
PolynomialQuotientRemainder[
4096 - 20480 k^2 + 16384 k^4 - 128 x^2 - 320 k^2 x^2 + x^4,
x^2 - f[k], x] == {x^2 - g[k], 0},
{f[k], g[k]}]
Surely there's a simple, one-line solution for my problem?
Of course.
SolveAlways[16384 k^4 - 20480 k^2 + x^4 - 320 k^2 x^2 - 128 x^2 + 4096 ==
(x^2 - f) (x^2 - g), x]
{{f -> 32 (2 + 5 k^2 - Sqrt[k^2 (40 + 9 k^2)]),
g -> 32 (2 + 5 k^2 + Sqrt[40 k^2 + 9 k^4])},
{f -> 32 (2 + 5 k^2 + Sqrt[k^2 (40 + 9 k^2)]),
g -> 32 (2 + 5 k^2 - Sqrt[40 k^2 + 9 k^4])}}