Let p(x) be a quadratic polynomial such that distinct reals a and b ,. p(a)=a and p(b)=b then find the roots of. p[p(x)]-x=0 Well a and b are surely two of the roots which I found easily but I cannot find the other.
I used the approach that 
P(x)=A(x-a)(x-b)+x
then I found p[p(x)]-x from which I can easily see that a and b are it's roots but how can I find the other two.
Note that $p(x)=x$ is a quadratic equation, hence, there exist at most two distinct real numbers that satisfy it. You have $p(a)=a$ and $p(b)=b$, hence, $a,b$ are these numbers. So, in your equation $p(p(x))=x$, the only roots are exactly the solutions of the (quadratic) equations $p(x)=a$ and $p(x)=b$. Since we know that $p(a)=a$ and $p(b)=b$, $a,b$ are two solutions.

Note that, as you have observed, $p(x)=C(x-a)(x-b)+x$, $C\neq0$. So:

$$p(x)=a\Leftrightarrow C(x-a)(x-b)+x-a=0\Leftrightarrow(x-a)(Cx-Cb+1)=0,$$

so, $x=a$ (we have found that) or $x=\dfrac{Cb-1}{C}$.

Similarly, we can find that the other two roots are $x=b$ or $x=\dfrac{Ca-1}{C}$.
Note that $p(x)=x$ is a quadratic equation, hence, there exist at most two distinct real numbers that satisfy it. You have $p(a)=a$ and $p(b)=b$, hence, $a,b$ are these numbers. So, in your equation $p(p(x))=x$, the only roots are exactly the solutions of the (quadratic) equations $p(x)=a$ and $p(x)=b$. Since we know that $p(a)=a$ and $p(b)=b$, $a,b$ are two solutions.

Note that, as you have observed, $p(x)=C(x-a)(x-b)+x$, $C\neq0$. So:

$$p(x)=a\Leftrightarrow C(x-a)(x-b)+x-a=0\Leftrightarrow(x-a)(Cx-Cb+1)=0,$$

so, $x=a$ (we have found that) or $x=\dfrac{Cb-1}{C}$.

Similarly, we can find that the other two roots are $x=b$ or $x=\dfrac{Ca-1}{C}$.