Equations with variables and substitution