Find the largest positive integer $n$ such that for all real numbers $a_{1},a_{2}, \dots ,a_{n},a_{n+1}$ the equation$$a_{n+1}x^2-2x\sqrt{a^2_{1}+a^2_{2}+ \dots +a^2_{n}+a^2_{n+1}}+\left(a_{1}+a_{2}+\dots +a_{n}\right) = 0$$has real roots.
My Try
If the given equation has real roots, then its discriminant must be greater than zero. So \begin{align*} 4\left(a^2_{1}+a^2_{2}+\dots +a^2_{n}+a^2_{n+1}\right)-4a_{n+1}\left(a_{1}+a_{2}+\dots +a_{n}\right) & \ge 0\\ \left(a^2_{1}+a^2_{2}+\dots +a^2_{n}+a^2_{n+1}\right)-a_{n+1}\left(a_{1}+a_{2}+\dots +a_{n}\right) & \ge 0 \end{align*}
After that how can I solve it? Thanks.
Let $x=a_{n+1}$ then the last inequality is $x^2-xT+S \ge 0$ where $T=a_1+a_2+\cdots+a_n$ and $S=a_1^2+a_2^2+\cdots+a_n^2$. This requires its own discriminant $\Delta=T^2-4s\le 0$. As you try increasing the number of $a_i$'s you see at 4 elements the inequality can be made to work but not after that. Here is how it turns out after a bit of algebra
for $n=1$ we have
$-\Delta=3a_1^2\ge 0$.
for $n=2$ we have
$-\Delta=2(a_1^2+a_2^2)+(a_1-a_2)^2 \ge 0$.
for $n=3$ we have
$-\Delta=1(a_1^2+a_2^2+a_3^2)+(a_1-a_2)^2 +(a_2-a_3)^2+(a_3-a_1)^2\ge 0$.
for $n=4$ we have
$-\Delta=0(a_1^2+a_2^2+a_3^2+a_4^2) \\ +(a_1-a_2)^2+(a_1-a_3)^2+(a_1-a_4)^2 +(a_2-a_3)^2+(a_2-a_4)^2+(a_3-a_4)^2\ge 0$.
for $n=5$ the inequality does not work for all possible $a_i$'s. Use the suggestion of @vonbrand, above, of setting all of them equal to say $t$ to see $-\Delta=4(5t^2)-(5t)^2=-5t^2 <0 $ for $t\ne 0$.