Is it possible to form a PDA for this language? $$L=\left \{ a^nb^m|n\leq m\leq 2n \right \}$$
Is this even context free?
I am asking because by looking at the condition, for an expression that holds:$n&lt; m&lt;2n$ can be written as : $a^nb^nb^c (c&lt;n)$.
Following this term(taken from geeks for geeks https://www.geeksforgeeks.org/check-if-the-language-is-context-free-or-not/) :&quot;An expression that involves counting and comparison of three or more variables independently is not context free language, as stack allows comparison of only two variables at a time.&quot;
So here I need to make sure that number of first b's is the same as a's and the second b's are less than n$(c&lt;n)$, which makes me think that L might not be context free(although it specified clearly to build PDA for this).
Yes, the language is context-free.  I recommend that you ignore that article on geeks for geeks; its so-called &quot;analysis&quot; is stated in a way that is highly ambiguous, and appears to be faulty in some cases.
Hint: The language has the form $L = \{a^j a^k b^k b^{2j}\}$.  Build a PDA that non-deterministically guesses $j$.  (I assume you know how to build a PDA for $\{a^n b^n\}$ and $\{a^n b^{2n}\}$.)