Back to Optimization

Exercise 40

Avg difficulty 2.5

According to The Song of Insects by G.W. Pierce (Harvard College Press, 1948) the sound of striped ground crickets chirping, in number of chirps per second, is related to the temperature. So the number of chirps per second could be a predictor of temperature. The data Pierce collected is shown in Table., where xx is the (average) number of chirps per second and yy is the temperature in degrees Fahrenheit.

A scatterplot of the data would show that, while the relationship between xx and yy is not exactly linear, it looks to have a linear pattern. It could be that the relationship is really linear but experimental error causes the data to be slightly inaccurate. Or perhaps the data is not linear, but only approximately linear.

Crickets chirping.
xxyy
20.020.088.688.6
16.016.071.671.6
19.819.893.393.3
18.418.484.384.3
17.117.180.680.6
15.515.575.275.2
14.714.769.769.7
17.117.182.082.0
15.415.469.469.4
16.216.283.383.3
15.015.079.679.6
17.217.282.682.6
16.016.080.680.6
17.017.083.583.5
14.414.476.376.3

If we want to use the data to make predications, then we need to fit a curve of some kind to the data. Since the cricket data appears roughly linear, we will fit a linear function ff of the form f(x)=mx+bf(x) = mx+b to the data. We will do this in such a way that we minimize the sums of the squares of the distances between the yy values of the data and the corresponding yy values of the line defined by ff. This type of fit is called a least squares approximation. If the data is represented by the points (x1,y1)(x_1,y_1), (x2,y2)(x_2,y_2), …\ldots, (xn,yn)(x_n,y_n), then the square of the distance between yiy_i and f(xi)f(x_i) is (f(xi)−yi)2=(mxi+b−yi)2(f(x_i)-y_i)^2 = (mx_i+b-y_i)^2. So our goal is to minimize the sum of these squares, of minimize the function SS defined by S(m,b)=∑i=1n(mxi+b−yi)2.\begin{gathered} S(m,b) = \sum_{i=1}^n (mx_i+b-y_i)^2. \end{gathered}

  1. Calculate SmS_m and SbS_b.

  2. Solve the system Sm(m,b)=0S_m(m,b) = 0 and Sb(m,b)=0S_b(m,b) = 0 to show that the critical point satisfies m=n(∑i=1nxiyi)−(∑i=1nxi)(∑i=1nyi)n(∑i=1nxi2)−(∑i=1nxi)2b=(∑i=1nyi)(∑i=1nxi2)−(∑i=1nxi)(∑i=1nxiyi)n(∑i=1nxi2)−(∑i=1nxi)2.\begin{aligned} m & = \frac{n\left(\sum_{i=1}^n x_iy_i\right) - \left(\sum_{i=1}^n x_i \right) \left(\sum_{i=1}^n y_i \right)}{n\left(\sum_{i=1}^n x_i^2 \right) - \left(\sum_{i=1}^n x_i \right)^2} \\ b & = \frac{\left(\sum_{i=1}^n y_i\right) \left(\sum_{i=1}^n x_i^2\right) - \left(\sum_{i=1}^n x_i \right) \left(\sum_{i=1}^n x_iy_i \right)}{n\left(\sum_{i=1}^n x_i^2 \right) - \left(\sum_{i=1}^n x_i \right)^2}. \end{aligned}

  3. Use the Second Derivative Test to explain why the critical point gives a local minimum. Can you then explain why the critical point gives an absolute minimum?

  4. Use the formula from part (b) to find the values of mm and bb that give the line of best fit in the least squares sense to the cricket data. Draw your line on the scatter plot to convince yourself that you have a well-fitting line.

Long, Keller & Schlicker, Active Calculus Multivariable, §11.10 Optimization, Exercise 40

AI Tutor

Adapted from Active Calculus Multivariable © 2013–2026 Nicholas Long, Mitchel T. Keller, and Steven Schlicker. Licensed under CC BY-SA 4.0. Source: Active Calculus Multivariable. Imported at revision 692c03c.