Calcoid

Nth Root Calculator

Compute the nth root of any real number for any integer index from 2 to 100. Handles cube roots, fourth roots, and the odd-n negative-radicand case. Detects perfect roots and reports the principal real root.

Nth root of a number

Any real number. Negative values work only when the index is odd.

Integer from 2 to 100. Use 3 for cube root, 4 for fourth root, and so on.

Exact (perfect) root

3

cube root of 27 = 3

Radicand (x)

27

Index (n)

3

Principal root

3

How this is computed

The nth root of x is x to the power of 1/n: x^(1/n). For negative x this is only defined in the real numbers when n is odd, in which case the calculator computes the magnitude root and applies the sign back. Perfect roots are detected within a tolerance of 1e-10.

Frequently Asked Questions about the Nth Root Calculator

How is the nth root of a number actually computed?
The nth root of x equals x^(1/n). For positive x, the calculator uses that identity. For odd n with negative x, it takes the root of the magnitude and restores the negative sign. For n = 2 it uses Math.sqrt. ECMAScript describes these finite math results as implementation-approximated, and the calculator rounds the displayed value to 10 decimal places.
Why is the nth root of a negative number undefined when n is even?
Because no real number, multiplied by itself an even number of times, is negative. Both 2 x 2 and (-2) x (-2) equal 4, so the even-index root of 4 is 2 in either direction; there is no real value whose 4th power is -16. The square root of -1 only exists in the complex numbers, where it is defined as the imaginary unit i. This calculator returns isReal = false and an explanation in errorReason whenever you ask for an even-index root of a negative number, instead of silently handing back NaN.
Why is cube root of -8 allowed but square root of -4 is not?
Cube roots (and every odd-index root) are defined for negative numbers in the reals because (-2) x (-2) x (-2) = -8: an odd number of negative factors stays negative. Even-index roots, like square or fourth, force the product back to non-negative, so they only accept non-negative inputs in the reals. The general rule: odd n + negative x is fine and produces a negative real root; even n + negative x has no real solution. The calculator enforces this distinction and shows the actual single real root in the odd-n case (e.g. -2 for cube root of -8, not 2).
What is the principal root, and does it differ from the result?
The principal nth root is the canonical real-valued root. For positive radicands and any n, it is the positive real root (square root of 9 is +3, not -3). For odd n with a negative radicand, it is the single real root, which is itself negative (cube root of -8 = -2). The calculator's result and principalRoot fields are the same number in every valid case; principalRoot is exposed separately so it is unambiguous which root you are getting, since algebraically the polynomial x^n = c has n complex roots and only one of them is real in the negative-x case.
How does the perfect-root detection work?
After computing the raw nth root, the calculator rounds to the nearest integer k, then checks whether k^n exactly recovers |radicand| within a tolerance of 1e-10 (scaled by the magnitude for large inputs). If it does, the result snaps to that integer and isPerfectRoot is set to true. This is what turns the floating-point answer for cube root of 27 (which would otherwise be something like 2.9999999999) into a clean 3. The tolerance is tight enough that it will not mistake the 4th root of 17 for a perfect root, but loose enough to absorb the unavoidable rounding in 1/n exponentiation.

Related Calculators

More calculators in "Math"

See all 202 calculators in "Math"