i want to use least square to find x and y that minimize the result of the following function for a series of points (xi,yi) -> (x1,y1), (x2,y2),...:
note: y = f(x)
E(x,y) = SUM (y - ((mi*x) - (mi*xi)))^2 i -------------------- 1 + |mi|^2
where "mi" is the slope of f(xi, yi)
now my math is very rusty, and i think to use least square to find x and y that minimize the function above i need to find the derivative of the function above in respect to x and y independently where the derivative of each is equal to 0.
can someone please show me how to perform derivation on the above function in respect to x and y please?
edit: I did check a few examples on the web, such as the one given below by potato, but here is where i have difficulty:
- these examples always look for m and b, thing is in my case, i already have m and b, what i need is the x that will give the best curve. in short, the curve im looking for has to be a point on the function f(x) with the optimized slope.
- This is due to my own shortcomings in calculus, but all examples give are only numerators, but the example i have above contains a denominator. Can someone help me understand how to derive with a denominator please?