Going backwards is somewhat arbitrary. There are any number of functions that have the same domains, thus it seems a bit silly (to me) to seek a function for a particular domain. Accept that it's just an exercise in the textbook.
For example, suppose the domain is [-3,3]
One possible function with this domain is f(x) = sqrt(9-x²)
(I'm going to assume that you're only working with real numbers)
Another function with the same domain is g(x)=arccos((1/3)x) (Note: this function is quite related to the first function.)
However, just to illustrate the infinite number of possible solutions, on the domain [-3,3]:
f(x)=sqrt(9-x²)
g(x)=sqrt(9-x²)+1
h(x)=sqrt(9-x²)+2
k(x)=sqrt(9-x²)+3
Suppose you want a domain that's 14 units wide, you could do this:
f(x)=sqrt(49-x²)
Now, suppose you want that domain 14 units wide, but let's shift it to the left about 5 units, so that instead of being from [-7,7], you can get it from [-12,2] Do this:
f(x)=sqrt(49-(x+5)²)
If you want to shift that domain 20 units to the right,
f(x)=sqrt(49-(x-20)²)
Now, suppose you don't want to include the ends of the intervals, say you want a function with the domain (2,10)
That's 8 units wide, so you can use the form sqrt(16-x²), but we're going to shift to the right 6 units, so the domain is centered at 6, rather than at 0:
f(x) = sqrt(16-(x-6)²) But wait! This includes 2 and 10. f(2) = 0. Easy fix:
f(x)=1/sqrt(16-x-6)^2)
Now, in your case, you've got an interval in the middle removed from the domain.
Look at what this does:
f(x) = sqrt(16-x²) + sqrt(x²-4)
For the first half of this function, you know that x has to be on [-4,4], but the second half of the function restricts x to values greater than or equal to 2 (or less than or equal to -2)
So, this f(x) has a domain of [-4,-2]U[2,4]
From here, it should be simple to figure out how to answer your question.