# GATE | GATE-CS-2001 | Question 31

Consider the following languages

Which of the languages are regular?

**(A)** Only L1 and L2

**(B)** Only L2, L3 and L4

**(C)** Only L3 and L4

**(D)** Only L3

**Answer:** **(D)** **Explanation:** A language is known as regular language if there exists a finite automaton (no matter whether it is deterministic or non-deterministic) which recognizes it. So if for a given language, we can come up with an finite automaton, we can say that the language is regular. But sometimes, it is not quite obvious to design an automaton corresponding to a given language but it surely exists. In that case, we should not start thinking that the given language is not regular. We should use pumping lemma to decide whether the given language is regular or not.

**According to pumping lemma, **

“Suppose L is a regular language, then there exists a l ≥ 1 such that for all string s ∈ L, where |s| ≥ l, we can always split s (there exists at least one such splitting) in such a way that s can be written as xyz with |xy| ≤ l and y ≠ ε and for all i ≥ 0 , xy^{i}z ∈ L”. l is known as pumping length.

Let’s rephrase the given Lemma for non regular languages. Suppose L is a language, if for all l ≥ 1 there exist a string s ∈ L with |s| ≥ l such that for all splitting (there doesn’t exists a single splitting which doesn’t follow this rule) of s in form of xyz such

that |xy| ≥ l and y ≠ ε , there exists an i≥ 0 such that xy^{i}z ∉ L, then L is not regular. Notice that here we stress on finding such s if we want to prove that a language is not regular.

**Choice of the Questions:**

(a) **In choice 1**, Lets first consider w being of length n and containing only a. In this case the language represents a^{n}a^{n}. The length of the string represented by language should be Even. Consider l = n, then xyz = a^{n}a^{n} with xy = a^{n}. lets assume y = a, then consider the membership of xy^{i}z with i = 0. This will simply be of odd length which doesn’t belongs to L. So L is not regular. To discuss it in more detail, let’s consider another example. Suppose w = a^{p}b, then string formed by L will be a^{p}ba^{p}b which is of length 2p + 2. Assume l = p, then xy = a^{p}. suppose y = a, then consider the membership of xy^{i}z with i = 0. This certainly doesn’t belongs to L. So L is not regular.

(b) **In choice 2**, The first example will work as above. In the second example, the string will be a^{p}bba^{p}, and there will be no changes in process for proving it to be non regular.

(c)** In choice 3**, Assuming that we are considering integer from 0 and 0^{2∗n} results in empty string, Which is also accepted, We can simply construct a DFA as given below. It simply accepts a string if it is either empty or contain even number of zeros. So the language is regular.

(d) **In choice 4**, We can simply assume that the pumping length l =i^{2}/2. Now consider the xy = 0^{l} with y = 0, Now if we check the membership of xy^{2}z, we can find that this will represent 0^{i^2}+1, and corresponding to which there exists no j such that

j^{2} = i^{2} + 1 where i and j are integer except j = 1 and i = 0. But since i can’t be zero. In Short, using pumping lemma, we can generate 0^{i^2}+1 as well as 0^{i^2}-1, which won’t be available in L.

So L is not regular.

This explanation has been contributed by **Durgesh Pandey.**

Quiz of this Question

## Recommended Posts:

- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 24
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 8
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 7
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 6
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 5
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 4
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 3
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 2
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 1
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 9
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 10
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 11
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 23
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 21
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 20