$$L=\left\{w\in\{x,y\}^*\mid N(y)=2N(x)\right\}$$
and $G$ is
$$S\to yySx\mid ySxSy\mid xSyy\mid SS\mid\epsilon$$
I need to proof that the grammar generates this language. I know that I need to use induction to prove it, but I can't follow through
so, could you show how to prove it?
There are two parts to this: you have to show that every word generated by $G$ is in $L$, and you have to show that every word in $L$ is generated by $G$. The first of these is straightforward. Suppose that $w$ is generated by $G$. Then it has a derivation
$$S=w_0\Rightarrow w_1\Rightarrow w_2\Rightarrow \ldots\Rightarrow w_{n-1}\Rightarrow w_n=w\,.$$
Clearly $|S|_x=|S|_y=0$, so $|S|_y=2|S|_x$. Now suppose that $0\le k<n$ and that $|w_k|_y=2|w_k|_x$, and verify that $|w_{k+1}|_y=2|w_{k+1}|_x$ no matter which production of $G$ is used to derive $w_{k+1}$ from $w_k$. Once you’ve done that, you can conclude by induction that $|w|_y=|w_n|_y=2|w_n|_x=2|w|_x$ and hence that $w\in L$.
The second part is a bit harder, but it can be done by induction on $|w|$. If $w\in L$ has length $0$, then $w=\epsilon$, which is generated by $G$. Now for the induction step let $n\in\Bbb Z^+$, suppose that every word of $L$ of length less than $n$ is generated by $G$, and let $w\in L$ be of length $n$; you need to show that $w$ is generated by $G$.
We’ll need to break the argument into cases, and we’ll use a technique that is useful but not obvious in order to do so. Say $w=u_1u_2\ldots u_n$, where each $u_k$ is either $x$ or $y$. Let $c_0=0$, and for $k=0,\ldots,n-1$ let
$$c_{k+1}=\begin{cases} c_k+1,&\text{if }u_k=y\\ c_k-2,&\text{if }u_k=x\,. \end{cases}$$
This is less complicated than it looks. Imagine reading $w$ from left to right, starting a counter at $0$, increasing it by $1$ each time you read a $y$, and decreasing it by $2$ each time you read an $x$; $c_k$ is the value of the counter after you’ve read $k$ letters of $w$. Because $w\in L$, it has twice as many $y$s as $x$s, so the counter must reach $0$ at the end of the word: $c_n=0$.
Now suppose that $c_k\ne 0$ for $1\le k\le n-1$.
Now suppose that $c_k\ne 0$ for $1\le k\le n-1$, and $u_1=y$, so that $c_1=1$. There are now two possibilities.
Note that each of the four cases is based on one of the non-terminal productions in $G$.