Suppose $A$ is an algebra of signature $\mathcal{L}$ and $V=Var(A)$ is the variety generated by $A$. I want to know is it possible to classify relatively free elements of $V$? As a special case, for a group $G$, under what conditions $G$ is free in $Var(G)$?



Relatively free algebras in a variety generated by a single algebra
Suppose that $A$ is a finite universal algebra with minimal cardinality of a generating set $d$. Then $A$ is relatively free in some variety iff it is relatively free on $d$ generators in the variety it generates, in which case it is free on any generating set of $d$ elements. Moreover, this occurs iff each map from a fixed $d$-element set generating $A$ to $A$ extends to an endomorphism.


It is easy to check that if $A$ is relatively free in some variety then it is relatively free in $Var(A)$. Next note that if $A$ is relatively free on $k$ generators, then the cardinality of $Hom(A,A)$ is $|A|^k$. On the other hand, $|Hom(A,A)\leq |A|^d$ and so $k\leq d$. But $d$ was minimal, so $A$ is free on $d$ generators. Also note that if $X$ is a free set of $d$-generators, then we can map $X$ to any other set of $d$-generators and this extends to a surjective homomorphism which is injective by finiteness. So all $d$-element generating sets are free generating sets.


Clearly if $A$ is relatively free on $d$ generators, then any map from a $d$-element generating set (necessarily a free generating set) to $A$ extends to an endomorphism. Suppose the converse holds. Let $B$ be the free algebra on $d$ generators in the variety generated by $A$. It is well known that $B$ embeds in a finite product $A^m$ where $m=|A|^d$. Let $g\_i\colon B\to A$ be the projection to the $i^{th}$ factor. If $f$ is the map taking the $d$ generators of $A$
to the free generators of $B$, then we can extend $g\_if$ to an endomorphism $h\_i$ of $A$ by hypothesis on $A$. The product $h$ of these $h\_i$ gives a homomorphism of $A$ to $A^m$ sending the generators of $A$ to the generators of $B$. Hence $h$ splits the canonical surjection $B\to A$.


**Added.** This last argument doesn't require finiteness. A universal algebra $A$ is relatively free if and ony if it has a generating set $X$ such that each map from $X$ to $A$ extends to an endomorphism. 


