HINT $\ $ Simpler, first solve $\rm\ f\: =\: (x^2 + c\ x + d)^2\:.\:$ This yields

$$\rm x^4 - 6\ x^3 +13\ x^2 +\cdots\ =\ x^4 + 2\:c\ x^3 + (2\:d+c^2)\ x^2\:+\cdots$$

hence $\rm\ 2\:c = -6\ $ so $\rm\ c = -3\:.\ $ And $\rm\ 2\:d+c^2 = 2\:d+9 = 13\ $ so $\rm\ d = 2\:.$


Both sides are identical polynomial expressions. The roots of the right are r,r,s,s. The sum of the roots is 6; this is seen by looking at the left. Hence, $2r+2s = 6$ so $r + s = 3$. The coefficient of the squared term is is the sum of the roots multiplied two at a time. From the left we see it is 13. From the point of view of $r$ and $s$, it is

$$r^2 + s^2 + 4rs.$$

Now substitute in $s = 3 - r$ and solve. You get $r = 1$ or $r = -2$. Now check out both possibilities.


You could apply Vieta's theorem; you would also arrive at a 4x4 non-linear system of equations, thus I'm not sure whether this method is lots easier than yours. The system of equations would look like this

$$\begin{vmatrix}2 x_1 + 2 x_2 = 6\\ x_1^2 + 4 x_1 x_2 + x_2^2 = 13\\ 2 x_1^2 x_2 + 2 x_1 x_2^2 = -a\\ x_1^2 x_2^2 = b \end{vmatrix}$$

and will give the solution $a = -12$ and $b=4$.


To elaborate on the calculus based method (which, in comparison to the other solutions here, I do not recommend), if we let $f=X^4−6X^3+13X^2+aX+b$, then we have double roots at $r$ and $s$ if $GCD(f,f')=k(x-r)(x-s)$ for some non-zero constant $k$. Going through the Euclidean algorithm to find $GCD(f,f')$, the first remainder we get is (up to a factor) $2X^2-6X(13+a)-(3a+8b)$, which cannot be $0$ for any choice of $a$ and $b$. Since we need that the greatest common divisor be quadratic, the next remainder has to be zero. Proceeding, the next remainder is $(104a+9a^2 +276b + 24ab)+2x(1352+222a+9a^2+4b)$. Therefore, we must have that both coefficients are zero.

Since $b$ appears linearly in both coefficients, we can solve for $b$ and set both expressions equal to each other to yield that $-b=\frac{1}{4}(9a^2+222a+1352)=\frac{9a^2+104a}{12(23+2a)}$. This gives a cubic equation for $a$, and once solved, yields $b$ too.

This can in principle be solved using Cardano's formula, or otherwise, and has the "advantage" that it does not require the intermediate step of writing things in terms of the roots. On the other hand, dealing with cubics is a huge pain.


A hybrid of this method and the other method might be to use the fact that, if the roots of $f$ are $r$ and $s$ (each with multiplicity $2$), then $2X^2−6X(13+a)−(3a+8b)$ has roots $r$ and $s$. We then have that $r+r+s+s=6$ and $r+s=3(13+a)$, so $a=-12$.

Then, the equation $1352+222a+9a^2+4b=0$, simplifies to $-16+4b=0$, or $b=4$.