The question asks to find the equation of the line passing through $(0,2)$ and just touching $y=(x+2)^{2}$ where $x>0$
I let the equation of the line have gradient $m$ therefore the line is $y=mx+2$ and for the lines to meet: $$mx+2=(x+2)^{2}$$ $$\therefore x^{2}-(4+m)x+2=0$$
I then let the discriminant equal zero and solved for $m$ to get: $$m=-4\pm\sqrt{2}$$ But $x>0$ therefore $m=-4+\sqrt{2}$
I then questioned this as to why I let the discriminant equal zero, and what does this mean. I then did it another way by again letting $mx+2=x^{2}-4x+4$ and solving this for $x$ by substitution with the equation $m=2x-4$ (their derivatives with respect to $x$ as the lines should only touch I realised the gradient at the points where they did would be equal). I again took the positive root as $x>0$ and again got $m=-4+\sqrt{2}$. My question is first of all is this correct and if so why did letting the discriminant be equal to zero give me those specific roots that I was looking for? Thanks