Is language $\{a,b\}^*$ same as language $\{xy \in \{a,b\}^* \mid |x|_a = |y|_b \}$?
You can prove this by induction on the length of the string.

The base case of $|z| = 0$ is obvious, we have to take $x=y=\varepsilon$.

The inductive assumption then is that $L =\{xy \in \{a,b\}^{\ast}\mid |x|_{a} = |y|_{b}\}$ contains all strings1 of length at most $n$.

Now we want to show that it contains all strings of length $n+1$.

Let $z \in  \{a,b\}^{n+1}$ and let $z^{-1}$ be $z$ with the final symbol removed. By the inductive assumption $z^{-1} \in L$. The final symbol $z_{n+1}$ in $z$ must be either an $a$ or a $b$.


If $z_{n+1}$ is an $a$, then we can construct an appropriate $x_{z}$ and $y_{z}$ by taking $x_{z} = x_{z^{-1}}$ and $y_{z} = y_{z^{-1}}a$. Then $|x_{z}|_{a} = |x_{z^{-1}}|_{a} = |y_{z^{-1}}|_{b} = |y_{z}|_{b}$, and therefore $z\in L$.
If $z_{n+1}$ is a $b$ we have a slightly more complicated situation, but it's not too difficult. The first symbol of $y_{z^{-1}}$ must also be either an $a$ or a $b$, or $y = \varepsilon$.


If the first symbol is an $a$, then we use the same $x$-$y$ partition as for $z^{-1}$, but we move the first symbol of $y$ to the end of $x$, and add the new $b$ to the end of $y$, then $|x_{z}|_{a} = |x_{z^{-1}}|_{a} + 1$ and $|y_{z}|_{b} = |y_{z^{-1}}|_{b} + 1$.
If the first symbol is a $b$, we do the same as in the $a$ case, but as we're adding a $b$ to $x$ and taking one $b$ away from $y$ but adding another at the end, the number of $a$s and $b$s in $x$ and $y$ don't change.
If $y_{z^{-1}} = \varepsilon$, then we simply choose $x = z$ and $y = \varepsilon$ and again $|x_{z}|_{a} = |x_{z^{-1}}|_{a} = |y_{z^{-1}}|_{b} = |y_{z}|_{b}$ (in fact, they all equal $0$, so $z = b^{n+1}$).



Therefore in all cases $z \in L$, and we are done.

Footnotes


...over alphabet $\Sigma = \{a,b\}$.