If $X$ is connected and $f:X\rightarrow Y$ is continuous and onto, then $Y $ is connected 
If $X$ is connected and $f:X\rightarrow Y$ is continuous and onto, then $Y $ is connected


Assume $Y$ is not connected, it exists a set $A$ such that its open and closed,
because $f$ is continuous, $f^{-1}$ takes open sets of $Y$ to open sets of $X$ and similarly close sets to close sets,
since $A$ is open in $Y$ then $f^{-1}(A)$ is open in $X$, similarly $f^{-1}(A)$ is closed in $X$, but that would mean $X$  is not connected, hence $Y$ is connected.
I am not using the fact that $f$ is onto. Is this correct ?
 A: No, it is not correct. If it was correct, then every topological space $Y$ would be connected. That's trivial if $Y=\emptyset$ and, if $y\in Y$, you just take $f\colon\{y\}\longrightarrow Y$ defined by $f(y)=y$. Since $\{y\}$ is connected, $Y$ would be connected too.
Every topological space $Y$ has a subset $A$ which is both open and closed (take $A=Y$, for instance). A topological space is connected when the only subsets which are both closed and open are $Y$ itself and $\emptyset$. If $A$ was not connected, there it would have a subset $A$, distinct from $Y$ and from $\emptyset$, such that $A$ would be both open and closed. And then $f^{-1}(A)$ would be both open and closed. But $f^{-1}(A)\ne\emptyset$ (since $A\ne\emptyset$ and $f$ is surjective) and $f^{-1}(A)\ne X$ (since $A\ne Y$ and $f$ is surjective). But $X$ is connected.
A: We'll use the following equivalent definition of a connected topological space $X$:
A topological space $X$ is connected, if there exist no open, disjoint and non-empty subsets $U_1,U_2 \subseteq X$, such that $X = U_1 \cup U_2$.
Assume $Y$ is not connected, i.e. there exist open non-empty sets $U_1,U_2 \subseteq Y$, such that $U_1 \cap U_2 = \emptyset$ and $Y = U_1 \cup U_2$. Then we have
$$ X = f^{-1}(Y) = f^{-1}(U_1 \cup U_2) = f^{-1}(U_1) \cup f^{-1}(U_2)$$
We have that $f^{-1}(U_i)$, $i=1,2$, is open in $X$, since $f$ is continuous. Moreover, $f^{-1}(U_i)$ is non-empty, since $f$ is onto (here is where we use onto). With these two preimages we have precisely a decomposition of the space $X$ as in the definition above, so $X$ is not connected, a contradiction.
Hope this helps!
A: $X$ is connected iff there is no continuous surjective map $g:X\to \{0,1\}$, where the latter space has the discrete topology.
Suppose in your situation we would have such a $g:Y \to \{0,1\}$. Then $g \circ f$ would be a continuous (composition of continuous) and surjective (composition of surjective) map to $\{0,1\}$, contradicting connectedness of $X$. It follows that $g$ cannot exist and $Y$ is thus connected.
