prove that l={w ∈ {0, 1}*: n0(w) ≠ n1(w)} is a non regular language? I tried doing this, but kept failing to prove. I know how to prove that the language is nonregular when  n0(w) = n1(w). The following is the proof for n0(w) = n1(w) using pumping lemma: 

Assume L is regular. Then, by the Pumping Lemma, there is a natural number m such
that any w ∈ L with |w| ≥ m can be factored as w = xyz with |xy| ≤ m and |y| &gt; 0,
and xyi
z ∈ L, for i = 0, 1...
Pick w = 0^m 1^m.
Then, 0^m 1^m = xyz, where y = 0k, for k &gt; 0.
By the Pumping Lemma, xz ∈ L.
But, n0(xz) does not equal n1(xz).
The assumption that L is regular thus is false.
Hence Proved


However, I don't know how to prove it for when number of 0 is not equal to number of 1.
There are two easy proofs that I will let you work out on your own. The first uses the fact that regular languages are closed under complement, the other uses the Myhill–Nerode criterion.

You can also prove that this language is not regular using the pumping lemma, but the proof is a bit tricky. Let $p$ be the pumping length, and consider the word $w = 0^p1^{p!+p} \in L$. The pumping lemma gives us some decomposition $w = xyz$ with $y = 0^i$ for $1 \leq i \leq p$. Then $xy^{1+p!/i}z = 0^{p!+p} 1^{p!+p} \notin L$.