Best fit line to a function

Calculus Level 4

The slope of the best-fit line that passes through the origin for f ( x ) = sin x x , x ( 0 , π 2 ) f(x)=\dfrac{\sin x}{x}, \ x\in \left(0,\dfrac{\pi}{2}\right) can be written as a b π c \dfrac{a}{b\pi^c} , where gcd ( a , b ) = 1 \gcd (a,b)=1 . Find a + b + c a+b+c .


Clarification: The best-fit line is the line such that the sum of each error squared is minimized.


The answer is 28.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Guilherme Niedu
May 22, 2017

I ( m ) = 0 π 2 ( m x sin ( x ) x ) 2 d x \large \displaystyle I(m) = \int_0^{\frac{\pi}{2}} \left (mx - \frac{\sin(x)}{x} \right )^2 dx

I ( m ) = 0 π 2 ( m 2 x 2 2 m sin ( x ) + sin 2 ( x ) x 2 ) d x \large \displaystyle I(m) = \int_0^{\frac{\pi}{2}} \left (m^2 x^2 - 2m\sin(x) + \frac{\sin^2(x)}{x^2} \right ) dx

We're looking for the m m that minimizes this integral. So:

d I ( m ) d m = 0 \large \displaystyle \frac {dI(m)}{dm} = 0

0 π 2 ( 2 m x 2 2 sin ( x ) ) d x = 0 \large \displaystyle \int_0^{\frac{\pi}{2}} \left ( 2mx^2 - 2\sin(x) \right ) dx = 0

[ 2 m x 3 3 + 2 cos ( x ) ] 0 π 2 = 0 \large \displaystyle \left [\frac{2mx^3}{3} + 2\cos(x) \right ]_0^{\frac{\pi}{2}} = 0

m π 3 12 2 = 0 \large \displaystyle \frac{m\pi^3}{12} - 2 = 0

m = 24 π 3 \color{#20A900} \boxed{ \large \displaystyle m = \frac{24}{\pi^3} }

Thus:

a = 24 , b = 1 , c = 3 , a + b + c = 28 \color{#3D99F6} \large \displaystyle a = 24, b = 1, c = 3, \boxed{ \large \displaystyle a+b+c = 28}

Steven Chase
May 21, 2017

We are presumably trying to minimize the following integral:

I = 0 π 2 ( m x s i n x x ) 2 d x = 0 π 2 ( m 2 x 2 2 m s i n x + s i n 2 x x 2 ) d x \large{I = \int_0^\frac{\pi}{2} (mx - \frac{sinx}{x})^2 dx = \int_0^\frac{\pi}{2} (m^2 x^2 - 2msinx + \frac{sin^2x}{x^2}) dx }

We're going to differentiate this integral with respect to m m and set to zero, so any term in the integrand without an m m term is irrelevant. The integral therefore becomes:

I = 0 π 2 ( m 2 x 2 2 m s i n x ) d x = π 3 24 m 2 2 m \large{I' = \int_0^\frac{\pi}{2} (m^2 x^2 - 2msinx) dx = \frac{\pi^3}{24} m^2 - 2m }

Differentiating and setting to zero gives:

π 3 12 m 2 = 0 m = 24 π 3 \large{\frac{\pi^3}{12} m - 2 = 0 \\ m = \boxed{\frac{24}{\pi^3}}}

nice solution(+1) i have edited out a typo in the first line that had a square in the second integrand.

Aareyan Manzoor - 4 years ago

Log in to reply

Thanks, and thanks. It was a fun problem.

Steven Chase - 4 years ago
Aareyan Manzoor
May 21, 2017

this can be solved by partial derivatives but i used projection matrices. For an unsolvable system of equations the best solution is given by A T A x = A T b A^T Ax=A^T b where A A was the original input, in this case a column vector of all numbers in ( 0 , π 2 ) \left(0,\dfrac{\pi}{2}\right) . x is a scalar in this case as there is only one variable to solve in. and b is the output, in this case sin ( a ) a \dfrac{\sin(a)}{a} . written in dot product notation we have x = A . b A . A = 0 π / 2 a sin ( a ) a d a 0 π / 2 a a d a x=\dfrac{A.b}{A.A} =\dfrac{\int_0^{\pi/2} a \dfrac{\sin(a)}{a} \ da}{\int_0^{\pi/2} a a\ da} both are easy integrals to solve and we have x = 24 π 3 x=\dfrac{24}{\pi^3}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...