Can't solve quadratic function

The key bit to notice is that you've been given the roots of such a quadratic. Namely the roots are ${x=0}$ and ${x=d}$. This must mean your quadratic can be written of the form

$${y=Ax(x-d)}$$

(since any polynomial can be factorised over it's roots) where ${A}$ is a constant to be determined.

If we plug in ${x=\frac{d}{2}}$, want the result to be ${2}$. As an equation, that is

$${A\frac{d}{2}\left(\frac{d}{2}-d\right)=2}$$

We can then rearrange for ${A}$ to get

$${A=\frac{2}{\frac{d}{2}\left(\frac{d}{2}-d\right)}=\frac{-8}{d^2}}$$

Hence

$${y=\frac{-8}{d^2}x(x-d)=-\frac{8}{d^2}x^2 + \frac{8}{d}}$$


Lagrange's interpolation formula instantly yields $$y(x)=2\,\frac{x(x-d)}{\frac d2\bigl(\frac d2-d\bigr)}.$$