Inserting/Numbering/Labelling/Referencing several times the same equation written in various form

\documentclass[a4paper]{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\defvariant}[1]{\label{#1}%
  \ifmeasuring@\else
    \expandafter\xdef\csname variant@#1\endcsname{\theequation}%
    \expandafter\gdef\csname variant@#1@number\endcsname{0}
  \fi}

\newcommand{\stepvariant}[2][]{%
  \ifmeasuring@\else
    \expandafter\xdef\csname variant@#2@number\endcsname{%
      \number\numexpr\csname variant@#2@number\endcsname+1\relax}%
    \tag{\ref{#2}\@alph{\number\csname variant@#2@number\endcsname}}%
    \if\relax\detokenize{#1}\relax\else\label{#1}\fi
  \fi}

\makeatother

\begin{document}
some text
\begin{equation}
   x-y=0 \defvariant{equal}
\end{equation}
some text
\begin{equation}
   x=y   \stepvariant[ea]{equal}
\end{equation}
some text. Now with an align environment
\begin{align}
   x^2-y^2&=0 \defvariant{squares} \\
   y-x&=0     \stepvariant[eb]{equal}
\end{align}
and with an align environment again
\begin{align}
  x^2&=y^2 \stepvariant[sa]{squares} \\
  x^2+x&=y^2+y 
\end{align}
Equations \eqref{ea}~and~\eqref{eb} are just different forms of 
Equation~\eqref{equal}, the same for Equation~\eqref{sa} and 
Equation~\eqref{squares}.
\end{document}

The command \defvariant defines an equation that can possibly have variant forms; its argument is also used to label the equation.

The command \stepvariant takes as mandatory argument the label of the "parent" equation and as optional argument a label for later reference.

A key point is \ifmeasuring@ that avoids stepping twice the pseudocounter for "children" equations in environments such as align and gather that typeset twice their contents, the first time for measuring the equation sizes (when \ifmeasuring@ is set to true).


this is not a full solution but just some hints on how to do it.

  1. You will have to define your own counter for "sub-equations":

    \newcounter{subequation}
    
  2. Define how you want to display such counter:

    \renewcommand{\thesubequation}{\alph{subequation}}
    
  3. You can then create a reference and label for the equation with:

    \refstepcounter{subequation} \label{someLabel}
    

Now, when you use \ref{somLabel}, you will have the number for that equation. There are some issues though, as it will not show the number of the first equation, but just a., b., etc. and it won't 'reset' on its own when stepping the main equation counter.

You can have it automatically reset by using:

\newcounter{subequation}[equation]

but this won't work with your example as you want to insert the new sub-counter for eq1 after already incrementing to eq2.

Anyway, these are just hints for what to look at. Maybe someone with better knowledge of counters could help there.