Find two functions, f(x) and g(x), such that f(x) and g(x) are each integrable but whose composition f(g(x)) is not integrable.

Hint: the problem "if g(x)=0 for irrational x and g(x)=1/q for x=p/q in lowest terms, show that g(x) is integrable on [0,1] and that its definite integral on [0,1] is equal to 0" is relevant.

I solved the problem in the hint (I think) but I'm not sure why it is relevant...I used it in my attempt at a solution but in that solution I could have instead used any integrable function with only rational numbers in its range.

Is this a possible solution?:

g(x) is the function described in the hint.

f(x)=x for all irrational x but f(x) undefined for rational x. Thus f(x) is integrable because it is non-decreasing and continuous at infinitely many points i.e. the limit as x->a of f(x)=a for all x, and f(x)=a for all irrational a therefore continuous at infinitely many irrational x

Thus f(g(x)) is undefined everywhere and certainly not integrable.

But: is f(x) really integrable or did I just try to cloak my ignorance by making a function that is undefined at infinitely many points and therefore is not integrable? I assumed f is integrable because of a theorem that "if f is nondecreasing it is integrable" but even if f is nondecreasing, (& it exists and is continuous at infinitely many points), if f is undefined at infinitely many points (the rational ones) isn't it non-integrable at those points and thus it cannot be "integrable" in the sense that it is integrable everywhere??????