Alternating between right align and left align for long equations

equationsmultline

I have a chain of long inequalities; I want to be able to break them up over multiple lines, so that the "left hand side" of the inequality can be 2 lines and the "right hand side" can also be 2 lines. I tried using multline environments but it doesn't work so far.

Ideally, the first line of the "left hand side" of the inequality would be left aligned, the second line of the "left hand side" of the inequality would be right aligned, and then it would go back to being left aligned for the first line of the "right hand side" of the inequality, and finally right aligned for the second line of the "right hand side" of the inequality. With more than 2 inequalities, I would prefer this alternating style if it's possible. Is there an environment for this?

For example

\begin{equation*}
    f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) &\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 1\\
    &\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 2\\
    &\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 3
\end{equation*}

The answer given so far is not sufficient. What I would like to have is the following output:

\begin{multline*}
f(x) + f(x) + f(x) + f(x) + f(x) + f(x)\\ + f(x) + f(x) + f(x) + f(x) + f(x) + f(x)
\end{multline*}
\begin{multline*}
\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x)\\ + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 1
\end{multline*}
\begin{multline*}
\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x)\\ + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 2
\end{multline*}

etc without using separate multline* environments.

Best Answer

This uses flalign, \mathllap and \mathrlap. I also tried an alternative style. (The second and third lines were originally one line. I can't decide which looks better.)

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{flalign*}
\mathrlap{f(x) + f(x) + f(x) + f(x) + f(x) + f(x)} \\
&& \mathllap{+ f(x) + f(x) + f(x) + f(x) + f(x) + f(x)} \\
\mathrlap{\quad\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x)} \\
&& \mathllap{+ f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 1}\\
\mathrlap{\quad\leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x)} \\
&&\mathllap{+ f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + 2}
\end{flalign*}

\begin{flalign*}
\mathrlap{f(x) + f(x) + f(x) + f(x) + f(x) + f(x)+ f(x) + f(x) + f(x) + f(x) + f(x)} \\
&& + f(x) & \\
&&& \leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) \\
&&&& \mathllap{ + f(x) + f(x) + f(x) + 1}\\
&&& \leq f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) + f(x) \\
&&&& \mathllap{ + f(x) + f(x) + f(x) + 2}
\end{flalign*}
\end{document}

demo