# \sqrt

Used for square roots and n-th roots in mathematical expressions, including radicands given as a single token, a grouped expression, or a bare fraction command.

https://texform.dev/latex/commands/sqrt

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Fractions and roots](https://texform.dev/latex/topics/fractions-roots) |
| Packages | base |
| Allowed mode | math |
| Tags |  |
| Commonality | high |
| Kind | prefix |

## Syntax

### base

Argument specification: `o m`

Used for square roots and n-th roots in mathematical expressions, including radicands given as a single token, a grouped expression, or a bare fraction command.

## Common tasks

### How to write a square root

```latex
\sqrt{x}
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%7Bx%7D)

### How to write an nth root

```latex
\sqrt[n]{x}
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%5Bn%5D%7Bx%7D)

### How to write a nested radical

```latex
\sqrt{1+\sqrt{2+\sqrt{3}}}
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%7B1%2B%5Csqrt%7B2%2B%5Csqrt%7B3%7D%7D%7D)

### How to write a cube root of a fraction

```latex
\sqrt[3]{\frac{a}{b}}
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%5B3%5D%7B%5Cfrac%7Ba%7D%7Bb%7D%7D)

## Examples

```latex
\sqrt{x}
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%7Bx%7D)

```latex
\sqrt[3]{x}
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%5B3%5D%7Bx%7D)

```latex
\sqrt\frac ab
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%5Cfrac+ab)

```latex
\sqrt[3]\frac ab
```

[Open in Playground](https://play.texform.dev/?input=%5Csqrt%5B3%5D%5Cfrac+ab)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| base | full | full | full |

## Usage frequency

6.99% of formulas in the measured corpus contain this entry, rank 8 of 263 entries with frequency data.

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

## Equivalent forms

```latex
\root #1 \of{#2}
```

exact. For the indexed form, TeX's general-root syntax is equivalent.

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \sqrt{a} | Positive: baseline | Pass | Pass | Pass |
| \sqrt[a]{b} | Positive: vary:o[0] | Pass | Pass | Pass |
| \sqrt a | Positive: bare[1] | Pass | Pass | Pass |
