Lesson 16 of 18

Root Test

The Root Test

The root test (also called Cauchy's root test) determines whether a series an\sum a_n converges by computing:

L=limnann=limnan1/nL = \lim_{n \to \infty} \sqrt[n]{|a_n|} = \lim_{n \to \infty} |a_n|^{1/n}

Conclusion:

  • L<1L < 1 → series converges absolutely
  • L>1L > 1 → series diverges
  • L=1L = 1inconclusive (try another test)

Comparison with the Ratio Test

Both tests use the same threshold (L<1L < 1 converges, L>1L > 1 diverges), but the root test is more powerful — it gives a conclusion in some cases where the ratio test is inconclusive. It is especially useful when ana_n is a power or exponential expression raised to the nn-th power.

Examples

(1/2)n\sum (1/2)^n — geometric series: L=limn(12n)1/n=12=0.5<1    convergesL = \lim_{n\to\infty} \left(\frac{1}{2^n}\right)^{1/n} = \frac{1}{2} = 0.5 < 1 \implies \text{converges}

2n\sum 2^n — divergent geometric: L=limn(2n)1/n=2>1    divergesL = \lim_{n\to\infty} (2^n)^{1/n} = 2 > 1 \implies \text{diverges}

nn\sum n^{-n} — ultra-fast convergence: L=limn(nn)1/n=lim1/n=0<1    convergesL = \lim_{n\to\infty} (n^{-n})^{1/n} = \lim 1/n = 0 < 1 \implies \text{converges}

Numerical Approximation

For large nn, an1/n|a_n|^{1/n} is a good approximation of LL:

double root_test_limit(double (*a)(int), int n) {
    return pow(fabs(a(n)), 1.0 / (double)n);
}

Your Task

Implement double root_test_limit(a, n) that computes an1/n|a_n|^{1/n} for a given term function aa and large nn.

TCC compiler loading...
Loading...
Click "Run" to execute your code.