In mathematics, an endomorphism is a morphism (or homomorphism) from a mathematical object to itself. For example, an endomorphism of a vector space V is a linear map ƒ: V → V, and an endomorphism of a group G is a group homomorphism ƒ: G → G. In general, we can talk about endomorphisms in any category. In the category of sets, endomorphisms are simply functions from a set S into itself.
In any category, the composition of any two endomorphisms of X is again an endomorphism of X. It follows that the set of all endomorphisms of X forms a monoid, denoted End(X) (or EndC(X) to emphasize the category C).
An invertible endomorphism of X is called an automorphism. The set of all automorphisms is a subset of End(X) with a group structure, called the automorphism group of X and denoted Aut(X). In the following diagram, the arrows denote implication:
Any two endomorphisms of an abelian group A can be added together by the rule (ƒ + g)(a) = ƒ(a) + g(a). Under this addition, the endomorphisms of an abelian group form a ring (the endomorphism ring). For example, the set of endomorphisms of Zn is the ring of all n × n matrices with integer entries. The endomorphisms of a vector space or module also form a ring, as do the endomorphisms of any object in a preadditive category. The endomorphisms of a nonabelian group generate an algebraic structure known as a nearring. Every ring with one is the endomorphism ring of its regular module, and so is a subring of an endomorphism ring of an abelian group, however there are rings which are not the endomorphism ring of any abelian group.
Operator theory 
In any concrete category, especially for vector spaces, endomorphisms are maps from a set into itself, and may be interpreted as unary operators on that set, acting on the elements, and allowing to define the notion of orbits of elements, etc.
Depending on the additional structure defined for the category at hand (topology, metric, ...), such operators can have properties like continuity, boundedness, and so on. More details should be found in the article about operator theory.
Endofunctions in mathematics 
Let S be an arbitrary set. Among endofunctions on S one finds permutations of S and constant functions associating to each a given . Every permutation of S has the codomain equal to its domain and is bijective and invertible. A constant function on S, if S has more than 1 element, has a codomain that is a proper subset of its domain, is not bijective (and non invertible). The function associating to each natural integer n the floor of n/2 has its codomain equal to its domain and is not invertible.
Finite endofunctions are equivalent to monogeneous digraphs, i.e. digraphs having all nodes with outdegree equal to 1, and can be easily described. For sets of size n, there are nn endofunctions on the set.
Particular bijective endofunctions are the involutions, i.e. the functions coinciding with their inverses.
- Jacobson (2009), p. 162, Theorem 3.2.