2.
MathWorks technical mcq question, verified with a worked answer. Free to practise - no sign-up.
2. (Math Question) Find cos (x) given x
Which of the following series can be used to calculate cos(x) for a given x?
Show answer & explanation
The Taylor series for cos(x) centered at 0 is $\sum_{n=0}^{\infty} (-1)^n \frac{x^{2n}}{(2n)!}$, which alternates in sign and uses only even powers of x. Option A matches this exactly with the alternating factor $(-1)^n$ and even-power terms $x^{2n}$ in the numerator and $(2n)!$ in the denominator. Option B is the series for $e^{-x}$, Option C omits the alternating sign and diverges for large x, and Option D is equivalent to $e^{-x}$ after algebraic manipulation.
Step-by-step Derivation:
Recall the Taylor series expansions:
- $e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + ...$
- $e^{-x} = \sum_{n=0}^{\infty} \frac{(-x)^n}{n!} = 1 - x + \frac{x^2}{2!} - \frac{x^3}{3!} + ...$
From Euler's formula: $\cos(x) = \frac{e^{ix} + e^{-ix}}{2}$
Adding the series for $e^{ix}$ and $e^{-ix}$ and dividing by 2 eliminates odd-power terms and doubles even-power terms:
$\cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + ... = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n}}{(2n)!}$
This matches Option A.