We usually give the definition of simple group as follows,
Simple Group. A group $(G,\circ)$ is said to be simple if it contains no proper nontrivial normal subgroup of $G$.
Where by trivial normal subgroup of a group $G$ we mean $\langle e\rangle$ where $e$ is the identity element of $G$.
Also, we may give the definition of a connected topological space as follows,
Connected Topological Space. A topological space $(X,\mathfrak{T})$ is said to be connected if it contains no proper nontrivial clopen subset of $X$.
I couldn't help but notice the similarity between these two definitions (especially the italicized parts of the definitions) and so I tried to formulate the definition of Simple Groups in an analogous manner of the following definition of Connected Topological Spaces,
A topological space $(X,\mathfrak{T})$ is said to be connected if for all continuous function $f:X\to\{0,1\}$, it is constant.
A "natural" analogue of this definition in case of simple groups can be,
Definition. A group $(G,\circ)$ is said to be simple if for all homomorphisms $f:G\to\mathbb{Z}_2$, it is constant.
However, I can't prove (or disprove) whether the above definition is equivalent to the definition of simple groups that I mentioned previously.
Questions
Can anyone help me in this?
If the definition is not equivalent then can some "functional" definition of a simple group be given?