One example of two functions f,g:X --> X that are discontinuous but their composition gof continuous is:
f(x) = 1/x and g(x) = x^2, where X is the set of all real numbers except 0.
Both f and g are discontinuous at x = 0, as f is undefined and g has a jump discontinuity at x = 0. However, their composition gof = f(g(x)) = 1/(x^2) is continuous for all x ≠ 0, as it is equal to f(g(x)) = f(x^2) = 1/(x^2).
Another example could be:
f(x) = floor(x) (the greatest integer function) and g(x) = x, where X is the set of all real numbers. Both f and g are discontinuous everywhere, as f has a jump discontinuity at all integers and g has a jump discontinuity at all non-integer points. However, their composition gof = f(g(x)) = floor(x) is continuous for all x, as it is equal to gof = floor(x) = x.