# Finding the Domain of the composition of piecewise functions

by Diego
(Paraguay)

Find the domain of: fog, gof, fof, gog.

For me these are the hardest types of problems one could face on a test regarding functions. I mean finding the domain of the composition of picewise defined functions.

I just found the fog function wich i think is:

1+x if x is less or equal to 0
(x+1)^2 if x is greater or equal to 1

I really just want to know the steps to solve this kind of problmes not this specific one (but that will be appreciated also).

These are indeed tricky problems. Here I'll try to give you some steps to follow for this kind of problems. To solve this analytically you need to have some experience dealing with inequalities.

Instead of that, I'll show you a graphic method. I'll walk you through the steps I'll follow to solve the specific problem you posted.

Let's say we want to find the domain of fog. The best way I can think of of doing this is to find the function itself. The notation fog means that
given a number x, we first apply g to it and then f.

So, we might write f as a function of y instead of x to clarify what is going on:

The domain of this function is clearly the set of real numbers. Now, what is the y we'll be using? It is f(x):

We now must consider all cases. We can do this analytically, but I think the easiest way is to graph these functions. You can quickly do this by hand, since they are fairly simple.

We will first graph g(x), since it is the first function to be applied:

We see that for x<0, g(x) is positive. So, according to our definition of f(y):

But what is g(x) for x<0? It is -x, because x<0 implies x<1. So we have:

We can now add that part of fog to our graph (in green):

Now, for 0

And for those values, g(x) = -x. So:

Let's add that to our graph:

And finally, for x>1 or x=1 we have that g(x) is postive. So:

For those values, g(x)=x+1. So:

And let's see what that looks like:

And that's it. Our piecewise function is:

Now, the original question is what is the domain of the function. Here we can consider the domain of this function the set of values that g(x)
actually takes. Let's look at the graph of this function:

We see that the values it takes is the set:

I think that this is what the question meant by domain of function. Because, we can consider the function fog as a function of x also. In this case, the domain of fog is the domain of g, which is the set of real numbers.