Consider following quadratic equation whose roots are $a$ and $b$.
$$x^2 +ax +b = 0 $$
We need to find $a$ and $b$ provided that $a,b\neq0$
So it seems a pretty easy question and it is,
From product of roots we get $a=1$ From sum of roots we get $b=-2$
Now I decided solve with an other way as follows-
Since $a$ and $b$ are roots of equation, therefore they will satisfy it as follows-
$ a^2 + a^2 + b = 0$ and hence $2a^2=-b$
$b^2 + ab +b=0$
Substituting value of $b$ we get
$4a^4-2a^3-2a^2=0$
Since $a\neq0$ solving for a gives two values $a=1$ and $a=-1/2$
and therefore corresponding values of $b$ as $-2,-1/2$ and hence we get following two quadratic equations
$x^2+x-2=0$ and $2x^2-x-1=0$
The first one has roots $(1,-2)=(a,b)$ , therefore we got one answer
but second one has roots $(1,-1/2)\neq(a,b)$
Why does this happens with second equations that it's roots are not equal to $a,b$
This system of equations does indeed follow from the problem statement, but it is not equivalent to it. Reason is that the problem assumes $a,b$ to be the roots of the quadratic, with emphasis on the plural of "roots".
The first solution based on Vieta's formulas preserves this assumption, and provides the correct result.
But the substitution that leads to the system of equations loses the distinction that $a,b$ must be the two roots of the quadratic, and allows for $a,b$ to be one and the same root.
In other words, extraneous solutions may be introduced among the solutions of the system, where $a$ is a root and $b=a$. Which is precisely what happened in this case with $a = b = -1/2$.
Therefore, the solutions to the system are not guaranteed to satisfy the original problem, and must be verified each. (Note: it is not safe to automatically reject any solution with $a=b$, because they could be equal in case a real solution existed which turned out to be a quadratic with a double root.)