# Order of accuracy of least squares for computing gradients

This is more of a numerical methods question. Hopefully, this is the right stackexchange board to post this question.

I am wondering if anyone is aware of the order of accuracy of using least squares to compute gradients, numerically, using the Linear basis:

$\phi = \begin{bmatrix} 1 & x & y & z \end{bmatrix}$

and

Quadratic basis: $\phi = \begin{bmatrix} 1 & x & y & z & xy & xz & yz & x^2 & y^2 & z^2 \end{bmatrix}$

With other schemes such as finite difference, I can just plug in taylor series approximations, and look at the truncation error to determine the theoretical order of accuracy, but I am not sure how to go about doing this with least squares.

• There is very little which can be done to help you unless you tell us exactly what you are doing. – Carl Christian May 3 '18 at 22:24
• I am using least squares to numerical compute gradients of a variable $u$ on a discretized domain (using finite volume method), and I am interested in knowing the theoretical order order of accuracy of using least squares for computing gradients, numerically. – David May 4 '18 at 15:34
• You need to describe the domain and codomain of your function $u$. We need the classification of the function, how smooth is it? We need to know how you measure the difference between two functions. Are you using the $L_2$ norm or the $l_2$ norm. Are you dealing with finitely many points or not? – Carl Christian May 5 '18 at 18:22
• So I am solving the linear elasticity equations, if that helps. When solving this equation, I need to compute gradients. The domain is $R^3$ in x,y,z coordinates. The codomain is also $R^3$. The function is smooth. I am dealing with discrete points because this is a numerical methods problem on a finite number of cells. So I use the $l_2$ norm. – David May 7 '18 at 0:12