Let be a disconnected space, say , where and are both open and non-empty. If and , prove that there can be no continuous function such that and .

I want to know HOW important is the "such that" thing.

Here is my attempt:

Let be continuous.

Then are both open in .

Also .

Again . Also hence these are non empty.

The above suggests that is disconnected which is wrong hence we have a contradiction.

Have i missed something or is the proof correct?