A block is released from O. Find the maximum distance travelled by the block.
Acceleration of the block will be $$g\sin\theta(1-x)$$ Velocity can be written as $$v^2=u^2+2ax$$ $$v^2=2(g\sin\theta(1-x))x$$
For x to be maximum, velocity needs of be zero. $$2g\sin\theta(x-x^2)=0$$ $$x=1,x=0$$ But the answer given is 2. What am I doing wrong.
NOTE: I know this is more of a physics question, but since my problem mostly lies with the math regarding this question, I posted it here

You are using an equation of constant acceleration whereas the acceleration you are using is variable. You must use calculus to solve this question.
$$\frac{dv}{dt}=g\sin\theta(1-x)$$
Therefore
$$v\frac{dv}{dx}=g\sin\theta(1-x)$$
Integrating from $0$ to $x$ $$\frac{1}{2}v^2=g\sin\theta(x-\frac{1}{2}x^2).$$
Therefore the velocity is zero when $x=2.$