[Tex/LaTex] LaTex Question On Square Roots

math-mode

What am I doing wrong here?

\begin {align}
$\frac{3}{\sqrt{y}}-\frac{1}{\sqrt{x}$}&=\frac{2}{\sqrt{x}+\sqrt{y}}$ \\
\frac{3}{a}-\frac{1}{b}&=\frac{2}{a+b} \\
$3(ab+b^2)-(a^2+ab)&=2ab$ \\
$3ab+3b^2-a^2-ab&=2ab$ \\
$3b^2&=a^2$ \\
$3(\sqrt{x})^2&=(\sqrt{y})^2$ \\
3x&=y \\
\frac{x}{y}&=\frac{1}{3}
\end {align}

this also does not work;

\begin {align*}
\frac{3}{$\sqrt{y}$}-\frac{1}{$\sqrt{x}$}&=\frac{2}{$\sqrt{x}$+$\sqrt{y}$} \\
\frac{3}{a}-\frac{1}{b}&=\frac{2}{a+b} \\
3(ab+$b^2$)-($a^2$+ab)&=2ab \\
3ab+3$b^2$-$a^2$-ab&=2ab \\
3$b^2$&=$a^2$ \\
3$($\sqrt{x}$)^2$&=$($\sqrt{y}$)^2$ \\
3x&=y \\
\frac{x}{y}&=\frac{1}{3}
\end {align*}

Best Answer

Firstly, remove the $ secondly encapsulate your equation in an equation environemt with \begin{equation} and \end{equation}. Furthermore, I would use \begin{aligned} instead of \end{align}. That should work.

Code after editing

\begin{equation}
\begin{aligned}
\frac{3}{\sqrt{y}}-\frac{1}{\sqrt{x}}&=\frac{2}{\sqrt{x}+\sqrt{y}} \\
\frac{3}{a}-\frac{1}{b}&=\frac{2}{a+b} \\
3(ab+b^2)-(a^2+ab)&=2ab \\
3ab+3b^2-a^2-ab&=2ab \\
3b^2&=a^2 \\
3(\sqrt{x})^2&=(\sqrt{y})^2 \\
3x&=y \\
\frac{x}{y}&=\frac{1}{3}
\end{aligned}
\end{equation}

Output

equation-output

Related Question