Can $a\sin{bx}$ be expressed in matrix form?

47 Views Asked by At

(I am trying to determine if given a dataset and this function, can it be solve using the Least Squared Error Method.) Thanks

1

There are 1 best solutions below

6
On

yes it can, so lets use your assumption that: $$y=a\sin(bx)$$ however there will be an associated error for each term, namely: $$r_i=y_i-y(x_i)$$ $$r_i=y_i-a\sin(bx_i)$$ now you simply define your sum: $$S=\sum r_i^2=\sum\left[y_i-a\sin(bx_i)\right]^2$$ now you want to optimise for $a,b$ such that $S$ is as small as possible, which would mean: $$\frac{\partial S}{\partial a}=0$$ $$\frac{\partial S}{\partial b}=0$$ can you take it from here?


$$\frac{\partial S}{\partial a}=-2\sin(bx_i)\left[y_i-a\sin(bx_i)\right]=0$$ $$\therefore y_i\sin(bx_i)-a\sin^2(bx_i)=0$$ $$\frac{\partial S}{\partial b}=-2ax_i\cos(bx_i)\left[y_i-a\sin(bx_i)\right]=0$$ $$\therefore ax_iy_i\cos(bx_i)-a^2x_i\sin(bx_i)\cos(bx_i)=0$$ unfortunately as you can see these two simultaneous equations are hard to solve for $a,b$. Also if it wasn't clear all of the above expressions are summations but I removed the symbols as it can make it look very messy