Situation: So I have three languages.
a) $L_1 =$ { $a^{2n-1}b^{2m} | n,m \geq 1$}
b) $L_2 =$ { $a^nb^ma^nb^m | n,m \geq 1$}
c) $L_3=$ { $a^nb^ma^{n+m} | n \geq 1, m \geq 0$}
So one of this languages is regular, one is context-sensitive, one is context-free.
My work:
for a) I found a context-free grammar:
$S \rightarrow aTbb $
$ T \rightarrow aaTbb| \varepsilon | aaT | Tbb $
edit: found a regular grammar for a). So my problem is only b).
For b) I tried so many grammars, but they did not represent the language $L_2$. My assumption is that this grammar is context-sensitive.
c)
$ S \rightarrow aSa|B $
$ B \rightarrow bBa| \varepsilon $
Yes, the language $L_2$ in (b) is context-sensitive. That language $L_2$ is actually often used as an example of a context-sensitive language; the Wikipedia article https://en.wikipedia.org/wiki/Context-sensitive_grammar discusses that language and shows several example grammars for it.
You are told that $L_2$ is either regular, context-free, or context-sensitive. How do you prove which one it is?
Recall that regular languages are a special subset of context-free languages. Context-free languages are a special subset of context-sensitive languages.
So if you can prove that $L_2$ isn't context-free, that will also prove that isn't regular either. In this homework problem, the only other option is context-sensitive, which means you'll have proved your answer by process of elimination.
To prove that a language is not context-free, you can use the specialized "pumping lemma for context-free languages". This involves a proof by contradiction: