[Tex/LaTex] Using \nearrow and \searrow to separate an equation in two alternatives

arraysarrowsequations

I'm tryin' to write the solution of an equation with two possible solutions, as x(ax-a+1)=0. I'm using \nearrow and \searrow with an array but I don't get it fits right. This is the code:

$\rightarrow x(ax-a+1)=0\begin{array}{ll}
 & {\color{red}{\color{red}x=0}}\\
\nearrow\\
\searrow & ax-a+1=0\rightarrow x=\dfrac{a-1}{a}\rightarrow{\color{red}{\color{red}x=1-\dfrac{1}{a}}}
\end{array}$

Best Answer

Instead of fixing your approach, I just show two other possibilities which I would prefer here.

% arara: pdflatex

\documentclass{article}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{tikz-cd}

\begin{document}
    \[\rightarrow x(ax-a+1)=0\rightarrow\begin{dcases}
    {\color{red}x=0}\\
    ax-a+1=0\rightarrow x=\frac{a-1}{a}\rightarrow{\color{red}x=1-\frac{1}{a}}
    \end{dcases}\]

    \[\begin{tikzcd}[%
    ,row sep={10,between origins}, column sep=15
    ,every arrow/.append style={start anchor=east, end anchor=west}
    ,/tikz/column 2/.append style={anchor=base west}
    ]
    & \color{red}x=0\\
    \rightarrow x(ax-a+1)=0 \arrow{ur}\arrow{dr} & \\
    & ax-a+1=0\rightarrow x=\dfrac{a-1}{a}\rightarrow{\color{red}x=1-\dfrac{1}{a}}
    \end{tikzcd}
    \]
\end{document}

enter image description here

The \rightarrow in front of the big brace is not really needed, though.

If you want to separate the arrows in my second example, you can do something like \arrow[shorten <= 1mm]{ur}\arrow[shorten <= 1mm]{dr} or you add some yshift to their start anchors.