Restriction of endomorphism to invariant subgroup is endomorphism

From Groupprops

Statement

Suppose is a group, is a subgroup and is an endomorphism of with the property that for all . Then, the restriction of to defines an endomorphism of .