The expansion of cos x about x = 0 is cos x = 1 − x²/2! + x⁴/4! − x⁶/6! + ⋯. This calculator evaluates the cosine Maclaurin series through a chosen even-power term; enter x in radians and the number of terms to get an approximation to cos x.
Formula
The Maclaurin expansion is:
cos x = Σk=0∞ (−1)kx2k/(2k)! = 1 − x²/2! + x⁴/4! − x⁶/6! + ⋯.
Here, x is the angle in radians, k is a whole-number term index beginning at zero, and (2k)! is the factorial of 2k. The calculator uses the first n terms, with k from 0 through n − 1. In other words, the final included power is x2(n−1). The input n is a positive whole number from 1 to 20. The output is a dimensionless approximation to cos x.
The expression in the calculator block, sum, represents the sum of those n series terms. The mathematical series is infinite; this calculator’s finite result is an approximation, not a symbolic representation of every term.
Worked Example
Using the block’s defaults, x = 1 radian and n = 5 terms. The included powers are 0, 2, 4, 6 and 8:
cos(1) ≈ 1 − 1²/2! + 1⁴/4! − 1⁶/6! + 1⁸/8!
= 1 − 0.5 + 0.0416666667 − 0.00138888889 + 0.0000248015873
≈ 0.540302305.
Rounded to six decimal places, the calculator reports 0.540302. The calculator’s displayed precision is not a guarantee that the approximation has six correct decimal places for every x and n; the truncation error depends on both inputs.
Assumptions
- The angle x is entered in radians, not degrees.
- The series is centered at zero and uses the first n terms, starting with 1.
- The result is a truncated Taylor-series approximation; no rounding is applied to intermediate terms in the formula.
Why the Cosine Series Has This Form
A Taylor series represents a function near a chosen center using its derivatives. For a function f at zero, the Maclaurin formula is f(x) = Σ f(k)(0)xk/k!. The derivatives of cosine repeat in a cycle: cos x, −sin x, −cos x, sin x, then back to cos x. At x = 0, every odd-order derivative is zero, while the even-order derivatives alternate between 1 and −1. That pattern gives only even powers and alternating signs.
The factorial in each denominator is essential. For instance, the coefficient of x⁴ is 1/4!, or 1/24, not simply 1/4. Factorials grow quickly, so for a fixed x the later terms generally become small. This is why the expansion can approximate cosine effectively near zero.
The series converges to cos x for every real x, not just small angles. However, convergence for all real inputs does not mean a short partial sum is equally accurate everywhere. Large values of |x| can require many terms before the approximation is useful.
Radians, Degrees, and Accuracy
The formula assumes radians. Radians are the natural angle unit for the standard derivative relationships that produce this series. If an angle is supplied in degrees, convert it before using the expansion: x radians = x degrees × π/180. For example, 60° is π/3 radians, so the series should use x = π/3, not x = 60.
For the alternating cosine series, the terms decrease in magnitude once the index is sufficiently large relative to |x|. When the terms are decreasing, the alternating-series error after truncation is no greater than the magnitude of the first omitted term. For n terms, that next term has magnitude |x|2n/(2n)!. This gives a practical error estimate when the decreasing-term condition holds. At large |x|, the early terms can grow before they eventually shrink, so that simple estimate should not be applied blindly.
For x = 1 and five terms, the first omitted term has magnitude 1/10! ≈ 0.00000027557. The actual error is smaller than this bound. For an input near 10 radians, by contrast, a handful of terms is not enough for comparable accuracy: terms such as 108/8! are large, and substantial cancellation occurs among the terms.
When to Use the Expansion
The expansion is useful for hand calculations, introductory calculus, and understanding how cosine behaves near zero. It also gives a direct way to estimate cosine when x is small, because the first terms often capture most of the value. For small x, cos x ≈ 1 − x²/2 is a common approximation; omitting x⁴/24 introduces an error whose size is roughly x⁴/24 when higher terms are smaller.
- Use one term for the simplest approximation: cos x ≈ 1.
- Use two terms for cos x ≈ 1 − x²/2.
- Add terms in pairs of powers, alternating signs: +x⁴/24, −x⁶/720, +x⁸/40320, and so on.
- Compare the first omitted term with the accuracy you need, provided the terms are decreasing.
For routine numerical work, a calculator or software cosine function is usually preferable. Numerical libraries commonly use range reduction and carefully designed approximations so they can handle a broad range of angles efficiently. The Taylor expansion remains valuable for explaining the mathematics and checking small-angle estimates.
Common Mistakes and Limitations
- Using degrees directly: The series requires radians. Convert degrees by multiplying by π/180.
- Misplacing factorials: The denominator is (2k)!, so the x⁶ term is −x⁶/6!, not −x⁶/6.
- Including odd powers: All odd-power coefficients are zero for cosine’s Maclaurin series.
- Assuming more terms always fix a poor calculation: More terms improve the convergent series mathematically, but finite-precision arithmetic can lose accuracy through cancellation for large |x|.
- Confusing a truncation with the full function: A finite polynomial is not exactly cosine except at particular inputs; it approximates the function.
The block allows up to 20 terms as a practical calculator limit, not because the mathematical series stops there. For extremely large angles, reduce the angle by multiples of 2π before using a short Taylor sum: cosine has period 2π, so cos(x) = cos(x − 2πm) for any integer m. This range reduction can bring the input closer to zero and improve the usefulness of a finite expansion.
Frequently Asked Questions
What is the cos x expansion formula?
It is cos x = 1 − x²/2! + x⁴/4! − x⁶/6! + ⋯, with x measured in radians.
What is the Maclaurin series for cos x?
The Maclaurin series is the Taylor series centered at zero: Σk=0∞(−1)kx2k/(2k)!. It contains only even powers.
Can I put degrees into the cosine expansion?
Not directly. Convert degrees to radians first using x radians = x degrees × π/180.
How many terms should I use?
It depends on the angle and required accuracy. Check the magnitude of the first omitted term when the alternating terms are decreasing; for large angles, use more terms or reduce the angle by multiples of 2π.
Why are the signs alternating?
Cosine’s even-order derivatives at zero alternate between 1 and −1, giving positive, negative, positive, negative coefficients in successive even powers.
Related
Formula used
in x | Angle x | rad | 1 | - in n | Number of terms | - | 5 | 1 | 20 out c | Cosine approximation | - | sum | 6
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.
More in this section
- Gas Correction Factor Formula and Calculator0.9829
- Gas Correction Factor Calculator and Table1.2534
- Gas Temperature: Calculate It from Pressure and Volume298.15 K
- Gas Correction Factor Calculator: Formula and Uses107.322 same as input
- Gas Cv Calculator: Heat Capacity Ratio and Formula20.786 J/(mol·K)
- Density Temperature Correction Calculator and Formula999.25 kg/m^3