the problem is:
f(x)={3x+5 if -1 < x < 2
.......{-x+9 if 2 < x < 5

Try to recall the analogy.

1. Buy the rock. (Graph the function)
2. Visualize the sculpture inside it. (Apply the given domain by drawing some vertical lines to help see the part of the function that you want)
3. Chisel away the parts that do not belong. (Erase the parts outside the given domain.)

The following link takes you through the above problem in a step by step way.