Consider a string, with a free end $P$ and another end $Q$ which is rigidly fixed.
Now, we start oscillating the point $P$ (with $0$ initial phase difference) and a wave starts traveling(in the positive $x$ direction) towards $Q$. Let us take the equation of this wave to be:
$$y=A\sin(\omega t-kx)$$
where we have taken the origin to lie at the point $P$.
Now, the equation of the reflected wave will be:
$$y=A\sin(\omega t+kx+π)$$
Applying superposition:
$$y=A\sin(\omega t-kx)+A\sin(\omega t+kx+π)=2A\cos\left(kx+\frac{π}{2}\right)\sin\left(\omega t+\frac{π}{2}\right)$$
Now, $y=0$ is required at the end $Q$ of the string for any positive value of $t$. Therefore:
$$\cos\left(kx+\frac{π}{2}\right)=0$$
However, since the length $PQ$ can be any arbitrary length and $y$ will be $=0$ regardless (at $Q$), so $\cos(kx+\frac{π}{2})=0$ should hold for all values of $x$, which is trivially false.
I suspect I have made a mistake in the equation of the reflected wave, and an answer with elaborate detail on how to reflect waves at rigid ends(and free ends also, if possible) would be appreciated. Also, the fact that there is a phase difference of $π$ during reflection at rigid ends is often mentioned, and I would like to how it is to be used.
Note: The question isn't concerned about whether a standing wave is produced or not. We are simply trying to find the equation of reflected wave by using the condition that y=0 at point Q at all times.