  In commutative algebra, a Weitzenb\"ock derivation is a nonzero triangular
linear derivation of the polynomial algebra $K[x_1,...,x_m]$ in several
variables over a field $K$ of characteristic 0. The classical theorem of
Weitzenb\"ock states that the algebra of constants is finitely generated. (This
algebra coincides with the algebra of invariants of a single unipotent
transformation.) In this paper we study the problem of finite generation of the
algebras of constants of triangular linear derivations of finitely generated
(not necessarily commutative or associative) algebras over $K$ assuming that
the algebras are free in some sense (in most of the cases relatively free
algebras in varieties of associative or Lie algebras). In this case the algebra
of constants also coincides with the algebra of invariants of some unipotent
transformation. \par The main results are the following: 1. We show that the
subalgebra of constants of a factor algebra can be lifted to the subalgebra of
constants. 2. For all varieties of associative algebras which are not nilpotent
in Lie sense the subalgebras of constants of the relatively free algebras of
rank $\geq 2$ are not finitely generated. 3. We describe the generators of the
subalgebra of constants for all factor algebras $K< x,y>/I$ modulo a
$GL_2(K)$-invariant ideal $I$. 4. Applying known results from commutative
algebra, we construct classes of automorphisms of the algebra generated by two
generic $2\times 2$ matrices. We obtain also some partial results on relatively
free Lie algebras.
