Aligning two equations with a ‘multiline’ bracket around them to previous equations

alignalignmentamsmath

I am trying to align a set of solutions of an equation to previous equations at the position of their equal signs. Next to the set equations is a bracket that goes over both lines. The code I already have is equivalent to the following:

\usepackage{amsmath}

\begin{align*}
    x^2 & = 1 \\
    \Rightarrow \quad \left\{
    \begin{array}{r l}
        x & = - 1 \\
        x & = 1
    \end{array}
    \right. \\
    x & = 1
\end{align*}

Output
Is there or can I set another marker to use for alignment? Are there other equation environments or solutions for the bracket itself that would make this obsolete?
Additionally, is there an option to reduce the space left to the equal signs of the last two equations to 'normal' size (to comparison I copied the last solution inside the normal equation environment)?

Edit: The last problem can be fixed by using aligned instead of array(Credit to @Teddy van Jerry).

Best Answer

This can be a solution provided your equation is not so complicated. The main concept is to overlap the part to the right of = using \mathrlap and compensate the width using \hphantom (This is needed because you certainly want the equation be centered.). \kern-\nulldelimiterspace after \right. is used to remove the additional space after \right..

\documentclass{article}
\usepackage{mathtools}

\begin{document}
    \begin{equation}
        \begin{aligned}
            x^2 = \mathrlap{1} & \\
            \Rightarrow \quad \left\{
            \begin{aligned}
                x & = \mathrlap{-1} \\
                x & = \mathrlap{1}
            \end{aligned}
            \right.\kern-\nulldelimiterspace & \hphantom{-1} \\
            x = \mathrlap{1} &
        \end{aligned}
    \end{equation}
\end{document}

TIP: mathtools auto includes the amsmath package and is more stable.

Result

Related Question