Does the standing wave equation proof require $\ell=Nλ$? Consider two identical sources $S_1$ and $S_2$ of waves, separated by a distance $\ell$ (as shown in the figure).

The sources produce waves in opposite directions(and towards each other). Now, suppose we wish to derive the equation for the standing wave produced.
Let us take the origin at $S_1$. The equation of the wave due to $S_1$ is:-
$$ y_1=A\sin(wt-kx_1)$$
where $x_1$ is the distance from $S_1$.
Now the equation of the wave due to $S_2$ is:-
$$ y_2=A\sin(wt-kx_2)$$
where $x_2$ is the distance from $S_2$. Note that here we take $x_2>0$.
Now, applying the principle of superposition, we get:-
$$ y=y_1+y_2=A\sin(wt-kx_1)+A\sin(wt-kx_2)$$
Now, observe $x_2=\ell-x_1$, so we get:-
$$ y=y_1+y_2=A\sin(wt-kx_1)+A\sin(wt-k(\ell-x_1))=A\sin(wt-kx_1)+A\sin(wt+kx_1-k\ell)$$
Using $\sin C+\sin D=2\sin\left(\frac{C+D}{2}\right)\cos\left(\frac{D-C}{2}\right)$, we get:-
$$y=2A \cos\left(kx-\frac {k\ell}{2}\right)\sin\left(wt-\frac{k\ell}{2}\right)$$
Note, that here we replace $x_1$ with $x$ since $x=x_1$ as the origin is at $S_1$.
However, the standard equation of stationary waves in such a case is given as $y=2A \cos(kx)\sin(wt)$. Using the equation we just derived, $\ell$ must =Nλ (where N is a non-negative integer) so that $k\ell=\frac{2π}{λ}.Nλ=2Nπ$ and now,
$$y=2A \cos\left(kx-\frac {2Nπ}{2}\right)\sin\left(wt-\frac{2Nπ}{2}\right)=2A (-\cos(kx))(-\sin(wt))=2A\cos(kx)\sin(wt))$$ as required.
Therefore, our proof of the standard equation of stationary waves requires $\ell=Nλ$. However, looking at the proof in my textbook, there is no discussion of this and the author uses $y=y_1+y_2=A\sin(wt-kx)+A\sin(wt+kx)$. A superficial explanation is given that a wave traveling in the opposite direction is taken with a '+kx' with no deeper reasoning. Although, my proof helps explain the origin of the '+kx' term (in the wave traveling in opposite direction), it adds a rather restrictive condition i.e. $\ell=Nλ$. Thus, I am skeptical about it.
Please help me out with two things:-

*

*Is my proof correct? If not, then what is the reasoning behind the '+kx'?

*If my proof is correct, then why isn't the $\ell=Nλ$ condition more commonly seen?

 A: The 'standard equation' that you quote arises from this superposition of progressive waves...
$$y=y_1+y_2=A\sin(\omega t-kx)+A\sin(\omega t+kx)$$
These 'component' waves are clearly in phase at $x=0$.
Your 'component' waves, $y_1=A\sin(\omega t-kx_1)$ and $y_2=A\sin(\omega t-kx_2)$ are not in phase at $x_1=0$ for an arbitrary choice of $l=x_1+x_2$. You should therefore not expect their superposition to yield the 'standard' equation that you quote.
The equation that you have derived for your component waves is, I think correct. As expected it differs from the 'standard' equation by added constants in the arguments of the trig functions.
A: I think that you're missing boundary conditions. Anytime you want to solve partial derivative equations, you have to provide boundary conditions, or the solution is undefined.
To get a standing wave, the most commun situation is to use "strict boundary conditions", where the wave's amplitude has to be zero on both extremities. If you take $y(x,t)=2A\cos(\omega t)\cos(kx)$ with $y(0,t)=y(l,t)=0$, you naturally get the quantization condition similar to the one you mentioned.
Another possibility is "periodic boundary conditions": the wave's amplitude must be equals on both ends, but not necessarily zero.
So far it's mostly math, so choosing the proper boundary conditions is where physics starts.
A: $$ S= \sin(kx-\omega t) + \sin(kx+\omega t)$$
First term:
$$\sin(kx-\omega t) =$$
$$\sin(kx)\cos(-\omega t) + \cos(kx)\sin(-\omega t)$$
$$\sin(kx)\cos(\omega t) - \cos(kx)\sin(\omega t)$$
Second term:
$$\sin(kx+\omega t) =$$
$$\sin(kx)\cos(\omega t) + \cos(kx)\sin(\omega t)$$
Adding them up gets:
$$2\sin(kx)\cos(\omega t)$$
This is the standard formula given that there are 2 waves in the form above.
Your situation:
You have described a different situation, in which there are 2 MIRROR sources, at a fixed distance between them.
The resulting standing wave is different as you have 2 waves in a form different than the above formula
Our first source wave moving to the right is described as:
$\sin(kx-\omega t)$
This function has a zero at $f(0,0)$
we want our secondary MIRROR source, to have the same behaviour at its location at $x=L$.
To find the corresponding wave I  will translate a standard wave moving to the left by $\gamma$.
$f_{2}(x,y) = \sin(k(x-\gamma)+\omega t)$
To match and be a mirror with the first source, the condition $f_{2}(L,0) = 0$ must be imposed
But the phase must also be accounted for, doing so with some diagrams you find that the phase must be $\pi +2n\pi$, ( to make the function zero at f(L,0))
$$\sin(k(x-\gamma)+\omega t) = f_{2}$$
$$\sin(k(L-\gamma)+\omega * 0) = 0$$
$$(k(L-\gamma)+\omega * 0)
 = \pi +2n\pi$$
$kL-k\gamma = \pi + 2n\pi$
$L-\frac{(\pi + 2n\pi)}{k} = \gamma$
Or simply
$L-\frac{\pi}{k} = \gamma$
Plugging it back into our equation
$f_{2}(x,y) = \sin(kx-kL+\pi + \omega t)$
Edit: Remember my original wave has a different form that  yours, try and see if you can do it with waves in your form! For 2 waves is this form, you get a silmar condition for the standard formula apply
Here they are the same provided
$L = n\lambda + 1/2\lambda$
Which is different than yours, but that's because I chose waves of a different form
A: You did correct mathematics deriving the standing wave equation
$$y=2Acos(kx-\frac {kl}{2})sin(wt-\frac{kl}{2})$$ which comes as the superposition of
$$y_1=Asin(wt-kx)$$ and $$y_2=Asin(wt+kx-kl)$$
However the other equation of standing wave which is
$$y=2Asin(wt)cos(kx)$$
comes as the superposition of the following two wave equations
$$Y_1=Asin(wt-kx)$$ and
$$Y_2=Asin(wt+kx)$$
Notice that $y_1$ and $Y_1$ are identical whereas $y_2$ has extra phase wrt $Y_2$. The two becomes identical only when that phase difference is $N×2\pi$.
Thus
$kl$ = $N×2\pi$, which gives $$l=N\lambda$$
Now coming to your first question,
Your derivation of standing wave is correct however there is a phase difference of $kl$ between the wave you described as travelling in -ve x axis and the wave defined by just changing -kx to +kx as done by the author.
Secondly, the condition $$l=N\lambda$$ is not generally seen because it's not a necessary condition. This condition just makes $y_2$ and $Y_2$ identical.
