f = {(1, −1), (4, −2), (9, −3), (16, 4)} and g = {(−1, −2), (−2, −4), (−3, −6), (4, 8)}
f : {1, 4, 9, 16} → {-1, -2, -3, 4} and g : {-1, -2, -3, 4} → {-2, -4, -6, 8}
Co-domain of f = domain of g
So, gof exists and gof : {1, 4, 9, 16} → {-2, -4, -6, 8}
But the co-domain of g is not same as the domain of f.
So, fog does not exist.