In my textbook it says that in composition of functions we require domain of second function to be EQUAL to the range of the first. My question is that why cannot the range of the first function be a subset of the domain of the second?
I understand your point. However since the fg means apply g first and then apply f to the answer, the domain of fg cannot include values that were not in the domain of g. The domain of f could have been 'wider' than that of g but the domain of fg would still be restricted to being the same as that of g.
Example g(x)=square root of x Domain: all x > or= to 0
f(x)=x^2 Domain: all real x
fg(x)=x Domain: all x > or= to 0