Skip to content

Calculus 2 problem set: integration techniques, the Gaussian, series, Taylor, polar, ODEs

ModuleS-M02 · solve · none · Pass 2 · 6 to 8 h
You buildanswers in solve/S-M02.toml (48 checked by SymPy) and 4 proofs in solve/S-M02/q12.md, q18.md, q30.md, q40.md (self-graded against their rubrics)
Contractnone: a pen and paper set
Testscourse/solve/S-M02/key.toml (hidden): typed answers plus reject canaries; the problems are in course/solve/S-M02/problems.md and in section 4
Needsno module. Reading: S-M01 (derivatives and the fundamental theorem) and the Calculus 2 topic
Used byno call site (a solve set). Take it after M02.1 (Taylor series in code) and M02.2 (the EMA as a geometric series) in Pass 2; M07.0 and M07.3 read its Gaussian integrals, which are the solve-only M02.3
MilestoneMS-P2 (the Pass 2 gate runs ol check on every solve part of the pass)
Optional depthOpenStax, Calculus Volume 2 (free), ch. 3 to 7; Trefethen, Approximation Theory and Approximation Practice, ch. 1 to 3, for why a few Taylor terms after range reduction are enough
  • Integration by parts is the product rule integrated; substitution is the chain rule integrated (q1 to q11, q12).
  • The Gaussian integral ∫e−x2=π\int e^{-x^2} = \sqrt{\pi} gives the normal density its constant, and half the second moment of a standard normal sits on each side of 0, which is the ReLU factor in Kaiming initialization (q16, q17).
  • A series converges when its partial sums do; terms going to 0 is necessary, not sufficient (q20, q30).
  • A Taylor polynomial plus a Lagrange remainder is an approximation with a guarantee; range reduction keeps the remainder small (q35, q38).
  • A first-order ODE describes a rate; the logistic equation’s solution is the sigmoid, and Euler’s method is one step of gradient descent on gradient flow (q48, q51, q52).
Terminal window
ol start S-M02 # writes solve/S-M02.toml and the four proof files
ol check S-M02 # SymPy checks the answers, then asks each proof rubric (y/n)
ol check S-M02 --regrade # ask the rubrics again after you change a proof

Your Pass 2 code leans on this calculus in three places. M02.1 computes exe^x and erf⁡\operatorname{erf} from Taylor polynomials, and its tests check a Lagrange remainder bound; M09.6 later puts the same polynomial in C. M02.2 treats the exponential moving average as a geometric series and derives Adam’s bias correction (M10.3) from its partial sum. And M07.0 and M07.3 draw normal random numbers and pick initialization scales from integrals of the normal density, which only exist because ∫e−x2\int e^{-x^2} converges to π\sqrt{\pi}. This set checks the hand techniques behind those modules: integrating by parts and by substitution, improper integrals, convergence, Taylor remainders, curves, and the simplest differential equations.

SymbolMeaningType / shape
u,vu, vfunctions in integration by partsfunctions
∫a∞f\int_a^\infty fimproper integral, lim⁡b→∞∫abf\lim_{b \to \infty} \int_a^b freal or divergent
φ(z)\varphi(z)standard normal density, e−z2/2/2πe^{-z^2/2}/\sqrt{2\pi}function
∑nan\sum_{n} a_n, SNS_Na series and its partial sum SN=∑n≤NanS_N = \sum_{n \le N} a_nreal
RRradius of convergence of a power series ∑cnxn\sum c_n x^nnonnegative real
Tn(x)T_n(x)degree nn Taylor polynomial at 0, ∑k≤nf(k)(0) xk/k!\sum_{k \le n} f^{(k)}(0)\, x^k / k!polynomial
Rn(x)R_n(x)remainder f(x)−Tn(x)f(x) - T_n(x)real
r,θr, \thetapolar coordinates: x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\thetareals
y(t)y(t), y′y'an unknown function of time and its derivativefunction
hhthe step size of Euler’s methodpositive real

Substitution reverses the chain rule: ∫f(g(x)) g′(x) dx=∫f(u) du\int f(g(x))\,g'(x)\,dx = \int f(u)\,du with u=g(x)u = g(x); change the limits with it. Integration by parts reverses the product rule: ∫abuv′=[uv]ab−∫abu′v\int_a^b u v' = [uv]_a^b - \int_a^b u' v; pick uu to get simpler when differentiated (xx, ln⁡x\ln x). Partial fractions split a rational function into simple pieces: 1x2−1=12(1x−1−1x+1)\frac{1}{x^2 - 1} = \frac{1}{2}\left(\frac{1}{x - 1} - \frac{1}{x + 1}\right). Trigonometric identities such as sin⁡2x=1−cos⁡2x2\sin^2 x = \frac{1 - \cos 2x}{2} and substitutions such as x=2sin⁡θx = 2\sin\theta remove square roots.

An integral over an infinite range, or of a function that blows up at an endpoint, is defined as a limit, and it converges when the limit is finite: ∫1∞x−2=1\int_1^\infty x^{-2} = 1 but ∫1∞x−1=∞\int_1^\infty x^{-1} = \infty; ∫01x−1/2=2\int_0^1 x^{-1/2} = 2 although the integrand is unbounded. The Gaussian integral I=∫−∞∞e−x2dxI = \int_{-\infty}^\infty e^{-x^2} dx has no elementary antiderivative, but I2I^2 is a double integral over the plane, and in polar coordinates (dx dy=r dr dθdx\,dy = r\,dr\,d\theta) it becomes ∫02π∫0∞e−r2r dr dθ=π\int_0^{2\pi}\int_0^\infty e^{-r^2} r\,dr\,d\theta = \pi. Substituting x=z/2x = z/\sqrt{2} gives ∫e−z2/2dz=2π\int e^{-z^2/2} dz = \sqrt{2\pi}, the constant of the normal density. By symmetry, ∫0∞z2φ(z) dz\int_0^\infty z^2 \varphi(z)\,dz is half of ∫−∞∞z2φ(z) dz=1\int_{-\infty}^\infty z^2 \varphi(z)\,dz = 1.

A series ∑an\sum a_n converges to SS when its partial sums SN→SS_N \to S. Tests: a geometric series ∑n≥0rn=11−r\sum_{n \ge 0} r^n = \frac{1}{1 - r} for ∣r∣<1|r| < 1; the pp-series ∑n−p\sum n^{-p} converges exactly for p>1p > 1 (compare with ∫1∞x−p\int_1^\infty x^{-p}, the integral test); the ratio test gives convergence when ∣an+1/an∣→L<1|a_{n+1}/a_n| \to L < 1; an alternating series with terms decreasing to 0 converges. A power series ∑cnxn\sum c_n x^n converges for ∣x∣<R|x| < R and diverges for ∣x∣>R|x| > R; each endpoint x=±Rx = \pm R needs its own test.

Tn(x)=∑k=0nf(k)(0)k!xkT_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(0)}{k!} x^k matches ff and its first nn derivatives at 0. Lagrange’s form of the remainder says f(x)−Tn(x)=f(n+1)(c)(n+1)!xn+1f(x) - T_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!} x^{n+1} for some cc between 0 and xx, so a bound on f(n+1)f^{(n+1)} bounds the error. The error grows like ∣x∣n+1|x|^{n+1}, so implementations shrink xx first: range reduction writes x=kln⁡2+rx = k\ln 2 + r with ∣r∣≤12ln⁡2|r| \le \frac{1}{2}\ln 2 and computes ex=2kere^x = 2^k e^r, where a degree 6 polynomial in rr already reaches float32 precision (M02.1, M09.6).

2.5 Parametric curves and polar coordinates

Section titled “2.5 Parametric curves and polar coordinates”

A curve x(t),y(t)x(t), y(t) has slope dydx=y′(t)x′(t)\frac{dy}{dx} = \frac{y'(t)}{x'(t)} and arc length ∫x′(t)2+y′(t)2 dt\int \sqrt{x'(t)^2 + y'(t)^2}\,dt. In polar coordinates the area swept by r(θ)r(\theta) is ∫12r2 dθ\int \frac{1}{2} r^2\,d\theta, and multiplying an equation by rr converts it with r2=x2+y2r^2 = x^2 + y^2, rcos⁡θ=xr\cos\theta = x, rsin⁡θ=yr\sin\theta = y.

y′=−kyy' = -k y has the solution y(t)=y(0) e−kty(t) = y(0)\,e^{-kt} (separate variables: dy/y=−k dtdy/y = -k\,dt). A linear equation y′+p y=q(t)y' + p\,y = q(t) is solved with the integrating factor e∫pe^{\int p}. The logistic equation y′=y(1−y)y' = y(1 - y) separates by partial fractions and gives the sigmoid. Euler’s method steps yk+1=yk+h f(tk,yk)y_{k+1} = y_k + h\,f(t_k, y_k). Gradient descent with learning rate hh is exactly Euler’s method on the gradient flow x′=−∇f(x)x' = -\nabla f(x), and M02.4 shows momentum is Euler on the heavy-ball equation.

This is a sibling of q1 and q17, not one of the graded problems.

By parts, twice. Compute ∫01x2e−x dx\int_0^1 x^2 e^{-x}\,dx. Take u=x2u = x^2, v′=e−xv' = e^{-x}, so u′=2xu' = 2x, v=−e−xv = -e^{-x}: the integral is [−x2e−x]01+2∫01xe−x dx=−e−1+2∫01xe−x dx[-x^2 e^{-x}]_0^1 + 2\int_0^1 x e^{-x}\,dx = -e^{-1} + 2\int_0^1 x e^{-x}\,dx. Again with u=xu = x: ∫01xe−x=[−xe−x]01+∫01e−x=−e−1+(1−e−1)=1−2e−1\int_0^1 x e^{-x} = [-x e^{-x}]_0^1 + \int_0^1 e^{-x} = -e^{-1} + (1 - e^{-1}) = 1 - 2e^{-1}. Total: −e−1+2−4e−1=2−5e−1≈0.1606-e^{-1} + 2 - 4e^{-1} = 2 - 5e^{-1} \approx 0.1606. In solve/ this is answer = "2 - 5*exp(-1)"; answer = "0.1606" fails as inexact.

A Gaussian moment. E[∣Z∣]=2∫0∞z φ(z) dz\mathbb{E}[|Z|] = 2\int_0^\infty z\,\varphi(z)\,dz for a standard normal ZZ. Substitute u=z2/2u = z^2/2, du=z dzdu = z\,dz: ∫0∞ze−z2/2dz=∫0∞e−udu=1\int_0^\infty z e^{-z^2/2} dz = \int_0^\infty e^{-u} du = 1. So E[∣Z∣]=22π=2/π≈0.798\mathbb{E}[|Z|] = \frac{2}{\sqrt{2\pi}} = \sqrt{2/\pi} \approx 0.798.

Write each answer in solve/S-M02.toml:

[q3]
answer = "pi/2 - 1"
[q19]
answer = "true"
[q28]
answer = "[-1, 1)"
[q45]
answer = "x^2 + y^2 = 2*y"
[q12]
proof = "S-M02/q12.md"

Numbers are exact (log(3/2)/2, not 0.2027). Taylor polynomials are checked symbolically, in any term order. Write ee as E or exp(1) and π\pi as pi.

q1. ∫01xex dx\displaystyle\int_0^1 x e^x\, dx (by parts). [number]

q2. ∫1eln⁡x dx\displaystyle\int_1^e \ln x\, dx. [number]

q3. ∫0π/2xcos⁡x dx\displaystyle\int_0^{\pi/2} x \cos x\, dx. [number]

q4. ∫01x1+x2 dx\displaystyle\int_0^1 \frac{x}{1 + x^2}\, dx (substitution). [number]

q5. ∫0π/2sin⁡2x dx\displaystyle\int_0^{\pi/2} \sin^2 x\, dx. [number]

q6. ∫231x2−1 dx\displaystyle\int_2^3 \frac{1}{x^2 - 1}\, dx (partial fractions). [number]

q7. Give the antiderivative FF of x2exx^2 e^x with F(0)=0F(0) = 0. [expr in x]

q8. ∫01x1−x2 dx\displaystyle\int_0^1 x \sqrt{1 - x^2}\, dx. [number]

q9. ∫0πxsin⁡x dx\displaystyle\int_0^\pi x \sin x\, dx. [number]

q10. ∫01x3ex2 dx\displaystyle\int_0^1 x^3 e^{x^2}\, dx. [number]

q11. ∫0114−x2 dx\displaystyle\int_0^1 \frac{1}{\sqrt{4 - x^2}}\, dx (substitute x=2sin⁡θx = 2\sin\theta). [number]

q12. Derive the integration by parts formula ∫abu v′ dx=[uv]ab−∫abu′ v dx\int_a^b u\,v'\,dx = \big[u v\big]_a^b - \int_a^b u'\,v\,dx from the product rule and the fundamental theorem of calculus. [proof]

q13. ∫1∞1x2 dx\displaystyle\int_1^\infty \frac{1}{x^2}\, dx. [number]

q14. ∫0∞e−2x dx\displaystyle\int_0^\infty e^{-2x}\, dx. [number]

q15. ∫011x dx\displaystyle\int_0^1 \frac{1}{\sqrt{x}}\, dx (improper at 0). [number]

q16. ∫−∞∞e−x2 dx\displaystyle\int_{-\infty}^{\infty} e^{-x^2}\, dx. [number]

q17. ZZ is a standard normal with density φ(z)=e−z2/2/2π\varphi(z) = e^{-z^2/2}/\sqrt{2\pi}. Give E[max⁡(Z,0)2]=∫0∞z2φ(z) dz\mathbb{E}[\max(Z, 0)^2] = \displaystyle\int_0^\infty z^2 \varphi(z)\, dz, the second moment of a ReLU of a standard normal. [number]

q18. Prove ∫−∞∞e−x2 dx=π\displaystyle\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi} by squaring the integral and changing to polar coordinates. [proof]

q19. Does ∑n=1∞1n2\displaystyle\sum_{n=1}^\infty \frac{1}{n^2} converge? [bool]

q20. Does ∑n=1∞1n\displaystyle\sum_{n=1}^\infty \frac{1}{n} converge? [bool]

q21. ∑n=0∞(23)n\displaystyle\sum_{n=0}^\infty \left(\frac{2}{3}\right)^n. [number]

q22. ∑n=1∞1n(n+1)\displaystyle\sum_{n=1}^\infty \frac{1}{n(n + 1)} (telescoping). [number]

q23. ∑n=1∞n2n\displaystyle\sum_{n=1}^\infty \frac{n}{2^n}. [number]

q24. Does ∑n=1∞n!nn\displaystyle\sum_{n=1}^\infty \frac{n!}{n^n} converge? (Ratio test.) [bool]

q25. Does the alternating series ∑n=1∞(−1)n+1n\displaystyle\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} converge? [bool]

q26. Give the sum ∑n=1∞(−1)n+1n\displaystyle\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}. [number]

q27. Give the radius of convergence of ∑n=1∞xnn\displaystyle\sum_{n=1}^\infty \frac{x^n}{n}. [number]

q28. Give the interval of convergence of ∑n=1∞xnn\displaystyle\sum_{n=1}^\infty \frac{x^n}{n}, endpoints included or not. [interval]

q29. Give the set of real pp for which ∑n=1∞1np\displaystyle\sum_{n=1}^\infty \frac{1}{n^p} converges. [interval]

q30. Prove that ∑n=1∞1n\displaystyle\sum_{n=1}^\infty \frac{1}{n} diverges. [proof]

q31. Give the degree 3 Taylor polynomial of exe^x at 0. [expr in x]

q32. Give the Maclaurin series of ln⁡(1+x)\ln(1 + x) through the x3x^3 term. [expr in x]

q33. Give the coefficient of x5x^5 in the Maclaurin series of sin⁡x\sin x. [number]

q34. Give the degree 4 Taylor polynomial of cos⁡x\cos x at 0. [expr in x]

q35. With the Lagrange remainder, bound ∣ex−T3(x)∣|e^x - T_3(x)| for ∣x∣≤1/2|x| \le 1/2, where T3T_3 is the degree 3 Taylor polynomial at 0. Use ec≤e1/2e^c \le e^{1/2} for the unknown point cc and give the bound. [number]

q36. Give the smallest nn with 1(n+1)!<10−6\dfrac{1}{(n + 1)!} < 10^{-6}. [number]

q37. Give the degree 3 Taylor polynomial of 11−x\dfrac{1}{1 - x} at 0. [expr in x]

q38. Range reduction writes x=kln⁡2+rx = k \ln 2 + r with kk the integer nearest to x/ln⁡2x / \ln 2, so that ex=2kere^x = 2^k e^r with ∣r∣≤12ln⁡2|r| \le \frac{1}{2}\ln 2. For x=5x = 5, give rr. [number]

q39. erf⁡(x)=2π∫0xe−t2 dt\operatorname{erf}(x) = \dfrac{2}{\sqrt{\pi}} \displaystyle\int_0^x e^{-t^2}\, dt. Give the first three nonzero terms of its Maclaurin series. [expr in x]

q40. Prove that ∣sin⁡x−(x−x36)∣≤∣x∣5120\left|\sin x - \left(x - \dfrac{x^3}{6}\right)\right| \le \dfrac{|x|^5}{120} for every real xx. [proof]

q41. The curve x=t2x = t^2, y=t3y = t^3. Give dy/dxdy/dx at t=1t = 1. [number]

q42. Give the arc length of x=cos⁡tx = \cos t, y=sin⁡ty = \sin t for 0≤t≤π/20 \le t \le \pi/2. [number]

q43. Give the arc length of x=t2x = t^2, y=t3y = t^3 for 0≤t≤10 \le t \le 1. [number]

q44. Give the area enclosed by the polar curve r=2cos⁡θr = 2\cos\theta, −π/2≤θ≤π/2-\pi/2 \le \theta \le \pi/2. [number]

q45. Rewrite the polar curve r=2sin⁡θr = 2\sin\theta as an equation in xx and yy. [equation in x, y]

q46. Give the area enclosed by the cardioid r=1+cos⁡θr = 1 + \cos\theta, 0≤θ≤2π0 \le \theta \le 2\pi. [number]

q47. Solve y′=−2yy' = -2y with y(0)=3y(0) = 3. [expr in t]

q48. Solve the logistic equation y′=y(1−y)y' = y(1 - y) with y(0)=1/2y(0) = 1/2. [expr in t]

q49. Solve y′+y=ty' + y = t with y(0)=0y(0) = 0. [expr in t]

q50. A quantity decays by y′=−kyy' = -k y and halves every 10 time units. Give kk. [number]

q51. Euler’s method on y′=yy' = y, y(0)=1y(0) = 1, with step h=1/2h = 1/2: give the approximation of y(1)y(1) after two steps. [number]

q52. Gradient flow on f(x)=x2/2f(x) = x^2/2 is x′(t)=−f′(x)=−xx'(t) = -f'(x) = -x. Starting from x(0)=4x(0) = 4, give the time at which x(t)=1x(t) = 1. [number]

PitfallSymptomCaught by
Losing the constant from du=g′(x) dxdu = g'(x)\,dxsubstitution answers off by a factor of 2q4 (canary log(2)), q6 (canary log(3/2)), q10 (canary 1)
Treating an unbounded integrand as a divergent integral∫01x−1/2\int_0^1 x^{-1/2} reported as infiniteq15 (canary oo)
Confusing the normalizers of e−x2e^{-x^2} and e−x2/2e^{-x^2/2}normal densities off by 2\sqrt{2}q16 (canary sqrt(2*pi))
Concluding convergence from terms that go to 0the harmonic series called convergentq20, q30 (proof)
Testing only the interior of an interval of convergencean endpoint included or dropped wronglyq28 (canaries), q29 (canary [1, oo))
Using the remainder of the wrong degree, or dropping its derivative factoran error bound that is too optimisticq35 (canaries)
Rounding the range-reduction quotient the wrong way$r
Ignoring the initial condition of an ODEa family of solutions instead of oneq47, q49 (canaries)
DirectionModuleHow it uses this
BackS-M01derivatives, antiderivatives, and the fundamental theorem
ForwardM02.1Taylor polynomials with range reduction for exp and erf, tested against the Lagrange bound of q35
ForwardM02.2the EMA as a truncated geometric series (q21) and its bias correction
ForwardM07.0the normal density’s constant (q16) behind Box-Muller normals
ForwardM07.3the ReLU second moment of q17 sets Kaiming’s gain 2\sqrt{2}
ForwardM02.4Euler’s method and gradient flow (q51, q52) explain momentum
ForwardS-M04multiple integrals and the change of variables behind q18