# How to Typeset the Square Root Symbol in LaTeX

The simplest method to write the square root symbol in LaTeX. Learn how to typeset the nth root, and adjust the root exponent position and radical symbol.

LaTeX is a popular document preparation system that allows users to create high-quality documents with a wide range of mathematical symbols and equations. One of the most commonly used mathematical symbols in LaTeX is the square root.

Typesetting a square root in LaTeX involves using the \sqrt command, which is a built-in function that takes the radicand as an argument and produces the square root symbol with the radicand inside it.

## LaTeX square root symbol

The mathematical symbol of the square root is ( ), where the square root of $$x$$ is written symbolically as $$\sqrt{x}$$.

In LateX, we need to use the \sqrt{} command to obtain the desired square root symbol. Here is an example of a LateX code to typeset square root and its corresponding output.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sqrt{64} = 8 \ \text{is equivalent to} \ 8^2 = 64$

\end document

$$\sqrt{64} = 8 \ \text{is equivalent to} \ 8^2 = 64$$

## How to write nth root in LaTeX

In the mathematical expression, the $$n^{th}$$ root of a number $$x$$ is the number $$b$$ such that $$b^n=x$$ and it is denoted as $$\sqrt[{n}]{x}$$. To obtain this in LateX, we can do it by using the \sqrt[n]{arg}, where [n] serves as the $$n^{th}$$ root and {arg} is the argument whose root is represented or evaluated. Observe the example below, where 2 is the $$n^{th}$$ root and $$x$$ is the argument root represented.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sqrt[2]{x}$

\end{document} 

The above code will produce the following output:

$$\sqrt[2]{x}$$

## Adjusting the root exponent (index) position

If your desire is to adjust the position of a root exponent or known as index, LaTeX will give your desired output by using \leftroot{} or \uproot{}. Check this LaTeX code and its output for you to find out:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sqrt[\leftroot{4} \uproot{2} x]{y}$\\

$\sqrt[\leftroot{10} \uproot{5} x]{y}$

\end{document}

The above code will give you the following output:

$$\sqrt[\leftroot{4} \uproot{2} x]{y}$$
$$\sqrt[\leftroot{10} \uproot{5} x]{y}$$

Remember:

• \leftroot{} moves the x argument to the left or to the right. To use this command \leftroot{argument} is \leftroot{5}, the argument 5 is the number of adjustments to your root exponent x to the left. If you move the root exponent x to the right, just substitute your argument with a negative argument.
• \uproot{} moves x up or down. Use a positive argument to move up or a negative argument to move down.

It is not necessary to use both commands, e.g. if you would like to move the root exponent up use only \uproot{} command, or rather you will move it to the left just use \leftroot only.

LaTeX radical symbol () is adjusted automatically depending on the height of your argument. Observe the example below:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sqrt{x}\, \sqrt{X}\, \sqrt{X^2_a}$

\end{document}

$$\sqrt{x}\, \sqrt{X}\, \sqrt{X^2_a}$$

As you can see, the radical symbol is created with different sizes, as mention above it depends to the height of your argument. To achieve the same height of the radical symbol, we can create a phantom vertical spacing equivalent to the argument with a big height. It can be obtained using the \vphantom{} command. From the example output above were going to follow the third radical symbol as our argument in using the \vphantom{} command to obtain equal sizes. Here is an example for you to find out with a corresponding output:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sqrt{x\vphantom{X^2_a}}\, \sqrt{B\vphantom{X^2_a}}\, \sqrt{X^2_a}$

\end{document}

$$\sqrt{x\vphantom{X^2_a}}\, \sqrt{B\vphantom{X^2_a}}\, \sqrt{X^2_a}$$

Important reminders:

1. \documentclass {class } – this command specifies the type of document you are dealing with and in this case, the type of document is an article.
2. \usepackage {amsmath} – it is placed in our preamble (area before \begin{document}). It takes the argument amsmath which is capable of interpreting and facilitating the writing of mathematical symbols, and formulas and improves the quality of the mathematics output in our document.
3. \begin {document} \end {document} – defines the document environment (i.e where all our text and equations enter).
4. \sqrt{} command – LaTeX command for square root. \sqrt{} takes an argument in the braces and returns it inside a square symbol e.g \sqrt{a}.
5. \text{…} command – LaTeX command which formats its argument by causing it to remain plain text even in math mode.
6. Spacing command\qquad and \quad are space commands. \qquad gives horizontal space which is twice \quad.
7. \vphantom{} -used to create an invisible vertical space that has the height and depth of a specified argument, but has no width.