# Find the least squares approximation

## Homework Statement

Suppose a set of N data points {(xk,yk)}Nk=1 appears to satisfy the relationship for some constants a and b. Find the least squares approximations for a and b.

## The Attempt at a Solution

fzero
Homework Helper
Gold Member
You don't say what the relationship is, but let's say it's some function that we'll call $$y=f(x,a,b)$$. The object of a least squares fit is to find $$a$$ and $$b$$ such that the sum of squares

$$S = \sum_{k-1}^N (y_k - f(x_k,a,b))^2$$

is minimized.

Thanks!
the relationship is y = ax + b/x.
Thus, S = Sigma ( y_k - (ax + b/x))^2, right?
and that's it?

fzero
Homework Helper
Gold Member
Thanks!
the relationship is y = ax + b/x.
Thus, S = Sigma ( y_k - (ax + b/x))^2, right?
and that's it?

S = Sigma ( y_k - (a x_k + b/x_k))^2

and you must minimize this as a function of a and b.

Thanks!
So, to minimize S, set partial derivative for a and b equals to zero.
right?
Thanks again.