Let's say that I have some function $z = f(x,y)$.
I know that if I want to calculate the partial derivatives of $x$ and $y$ numerically that I can use finite differences, like the central differences method below:
$$\frac{dz}{dx} = \frac{f(x+\varepsilon, y) - f(x-\varepsilon,y)}{2*\varepsilon}\\ $$ and $$ \frac{dz}{dy} = \frac{f(x, y+\varepsilon) - f(x,y-\varepsilon)}{2*\varepsilon}$$
However, let's say that I have two (or more) triplets of $z=f(x,y)$. Like say $2 = f(4,5)$ and $3=f(8,2)$. Can I use that information to estimate partial derivatives?
My attempt at a guess on how to do this would be: $$\frac{dz}{dx} = \frac{3-2}{8-4} = \frac{1}{4}$$ and $$\frac{dz}{dy} = \frac{3-2}{2-5} = \frac{1}{-3}$$
Is that method valid? Are there better ways? What sort of accuracy can I expect?
$dz = \frac {\partial z}{\partial x} dx + \frac {\partial z}{\partial y} dy$
If you have 3 pairs of (x,y) you can find the vectors $\mathbf u = (x_1-x_0, y_1-y_0), \mathbf v = (x_2-x_0, y_2-y_0)$
$\frac {\partial z}{\partial \mathbf u} = \frac {z(x_1,y_1) - z(x_0,y_0)}{\|\mathbf u\|}\\ \frac {\partial z}{\partial \mathbf v} = \frac {z(x_2,y_2) - z(x_0,y_0)}{\|\mathbf v\|}$
There exists some $a,b$ such that $a\frac {\mathbf u}{\|\mathbf u\|} + b\frac {\mathbf v}{\|\mathbf v\|} = (1,0),$ and $m,n$ such that $m\frac {\mathbf u}{\|\mathbf u\|} + n\frac{\mathbf v}{\|\mathbf v\|} = (0,1)$
$\frac {\partial z}{\partial x} = \frac {a \frac {\partial z}{\partial \mathbf u}+ b\frac {\partial z}{\partial \mathbf v}}{\sqrt {a^2+b^2}}\\ \frac {\partial z}{\partial y} = \frac {m \frac {\partial z}{\partial \mathbf u}+ n\frac {\partial z}{\partial \mathbf v}}{\sqrt {m^2+n^2}}$
if $\|\mathbf u\|,\|\mathbf v\|, \sqrt {a^2+b^2},\sqrt {n^2+m^2}$ are large the errors in your estimates increase.