'why a^m b^n where m,n > 0 is a regular language but a^n b^n where n > 0 is non regular language

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?



Solution 1:[1]

In the second language the number of a's and b's have to be the same. The finite automata would need the ability to count the number of a's to check if the number of b's are the same. This would need an infinite amount of states.

Maybe check out the pumping lemma on wikipedia: https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Runinho