a^m b^n where m,n >= 0 is a regular language but why a^n b^n where n >= 0 is a non-regular language? In both languages, we are taking an infinite number of a's and b's but why we could build a Finite Automata for the first case and not for the second case?
Let us consider the above languages as A,B:
X = a^m b^n where m,n>0
Y = a^n b^n where n>0
Language X is a regular language but Language Y is not a regular language because we cannot construct a Finite automata for language Y.
A language is not a regular language if the language does not satisfy the pumping lemma , but if the language satisfies the pumping lemma then the language need not be regular.
In case of language X the number of a's and b's are different so we need not remember number of occurrences of 'a' after accepting all a's we can accept b's and move to final state ,but in case of language Y the number of a's and b's are same. So all the strings in the language Y should contain equal number of a's and equal number of b's. So we need to remember the number of a's so that b's can be evaluated, which is not possible using finite automata. So to evaluate tese kind of languages push down automata is required.
PushDown automata = Finite automata + some amount of memory(stack).
The languages of the kind Y are called context free language and they can be evaluated using Pushdown Automata(PDA).Finite automata do not have any memory to store the count of a's and b's. where as pushdown automata has some amount of memory so we can evaluate languages of type Y.
For this language Y we need to push all the a's on to the stack and whenever we encounter b's then we need to pop a's(remembering the condition that all the a's must be before b's).If all the a's are not before b's then we need to move the system to dead state.