You have to show that this works for any arbitrary function. Picking a particular function (as you did) will not suffice.

You are really being asked to show two things:

1) If is pathwise connected, is a space, and \to X" alt="f\to X" /> is continuous, then is pathwise connected.

2) A subset of is pathwise connected if and only if it is an interval.

Give it a try.