The definition of connectedness in my notes is: A topological space $X$ is connected if there does not exist a pair of non empty subsets $U$, $V$ such that $U\cap V=\emptyset$ and $U\cup V=X$.
However if I have the subsets $(-\infty,0]$ and $(0,\infty)$ then these are disjoint and cover $\mathbb R$ and hence $\mathbb R$ is disconnected.
However $\mathbb R$ is clearly connected. Where have I gone wrong?
The subsets that you take are wrong because $(-\infty ,0]$ contains a accumulation point of $(0,\infty)$.