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?
That definition is not correct. For instance, the group $\mathbb{Z}_2$ is simple, but the identity homomorphism $\mathbb{Z}_2\to\mathbb{Z}_2$ is nonconstant. Or if $G$ is any finite group of odd order, any homomorphism $G\to\mathbb{Z}_2$ is constant, but $G$ need not be simple. The problem is that in contrast with clopen subsets of a topological space, you can't just take a normal subgroup $K\subset G$ and get a homomorphism $G\to\mathbb{Z}_2$ by mapping $K$ to $0$ and every other element of $G$ to $1$. That usually won't be a homomorphism.
A correct "functional" definition of a simple group is that a nontrivial group $G$ is simple if any homomorphism $f:G\to H$ from $G$ to any other group is either injective or trivial (where "trivial" means it sends every element to the identity). Indeed, a homomorphism is injective iff its kernel is the trivial subgroup and trivial iff its kernel is all of $G$, so this is just saying the only normal subgroups of $G$ are the trivial subgroup and $G$.
(Aside: I require $G$ to be nontrivial in this definition because the trivial group is not simple; similarly, the empty topological space is not connected (see https://ncatlab.org/nlab/show/too+simple+to+be+simple). You can avoid stating that $G$ is nontrivial by saying instead that every homomorphism $f:G\to H$ is exactly one of injective and trivial. Similarly, you can fix the definition of connectedness by saying every continuous $f:X\to\{0,1\}$ has exactly one point in its image.)