$f(x) = $ the function we are approximating the derivative of.
$\bar{x} =$ the point at which we are approximating the derivative.
h = the step size of our finite difference grid.
$y_k = f(\bar{x}_0 + k h) =$ the function, evaluated along our evenly spaced samples.
$p(x) = c_i x^i =$ the polynomial approximation of the derivative.

$A_{ij} = [ (\bar{x}_0 + i \cdot h)^{j-1} ]$
${\vec{y}} = {{{\mathbf{A}}} \cdot {{\vec{c}}}}$

${\vec{c}} = {{{{\mathbf{A}}^{-1}}} {{\vec{y}}}}$


Central Difference, 1st deriv


...2 order


${{\vec{c}} = {{{{\mathbf{A}}^{-1}}} {{{y_i}}}}} = {{{\left[\begin{array}{ccc} \frac{{{\bar{x}}} \cdot {{\left({{\bar{x}} + {h}}\right)}}}{{{2}} {{{h}^{2}}}}& \frac{{-{{\bar{x}}^{2}}} + {{h}^{2}}}{{h}^{2}}& \frac{{{\bar{x}}} \cdot {{\left({{\bar{x}}{-{h}}}\right)}}}{{{2}} {{{h}^{2}}}}\\ -{\frac{{h} + {{{2}} {{\bar{x}}}}}{{{2}} {{{h}^{2}}}}}& \frac{{{2}} {{\bar{x}}}}{{h}^{2}}& \frac{{h}{-{{{2}} {{\bar{x}}}}}}{{{2}} {{{h}^{2}}}}\\ \frac{1}{{{2}} {{{h}^{2}}}}& -{\frac{1}{{h}^{2}}}& \frac{1}{{{2}} {{{h}^{2}}}}\end{array}\right]}} {{\left[\begin{array}{c} {y_{1}}\\ {y_{2}}\\ {y_{3}}\end{array}\right]}}}$

${{p(x)} = {{{{x^j}}} \cdot {{{\mathbf{A}}^{-1}}} {{{y_i}}}}} = {{{\left[\begin{array}{ccc} 1& x& {x}^{2}\end{array}\right]}} {{\left[\begin{array}{ccc} \frac{{{\bar{x}}} \cdot {{\left({{\bar{x}} + {h}}\right)}}}{{{2}} {{{h}^{2}}}}& \frac{{-{{\bar{x}}^{2}}} + {{h}^{2}}}{{h}^{2}}& \frac{{{\bar{x}}} \cdot {{\left({{\bar{x}}{-{h}}}\right)}}}{{{2}} {{{h}^{2}}}}\\ -{\frac{{h} + {{{2}} {{\bar{x}}}}}{{{2}} {{{h}^{2}}}}}& \frac{{{2}} {{\bar{x}}}}{{h}^{2}}& \frac{{h}{-{{{2}} {{\bar{x}}}}}}{{{2}} {{{h}^{2}}}}\\ \frac{1}{{{2}} {{{h}^{2}}}}& -{\frac{1}{{h}^{2}}}& \frac{1}{{{2}} {{{h}^{2}}}}\end{array}\right]}} {{\left[\begin{array}{c} {y_{1}}\\ {y_{2}}\\ {y_{3}}\end{array}\right]}}}$

let ${\bar{x}} = {x}$
${\frac{\partial p(x)}{\partial x}} \approx {{{\frac{1}{h}}} {{{\frac{1}{2}}{\left({{-{{y_{1}}}} + {{y_{3}}}}\right)}}}}$

${\frac{\partial p(x)}{\partial x}} \approx {{{\frac{1}{h}}} {{\left[\begin{array}{ccc} -{\frac{1}{2}}& 0& \frac{1}{2}\end{array}\right]}} {{\left[\begin{array}{c} {y_{1}}\\ {y_{2}}\\ {y_{3}}\end{array}\right]}}}$

...4 order


${{\vec{c}} = {{{{\mathbf{A}}^{-1}}} {{{y_i}}}}} = {{{\left[\begin{array}{ccccc} \frac{{{{2}} {{{\bar{x}}^{3}}} {{{h}^{3}}}}{-{{{{\bar{x}}^{2}}} {{{h}^{4}}}}} + {{{{\bar{x}}^{4}}} {{{h}^{2}}}}{-{{{2}} {{\bar{x}}} \cdot {{{h}^{5}}}}}}{{{24}} {{{h}^{6}}}}& \frac{{-{{{{\bar{x}}^{3}}} {{{h}^{3}}}}}{-{{{{\bar{x}}^{4}}} {{{h}^{2}}}}} + {{{4}} {{\bar{x}}} \cdot {{{h}^{5}}}} + {{{4}} {{{\bar{x}}^{2}}} {{{h}^{4}}}}}{{{6}} {{{h}^{6}}}}& \frac{{{\bar{x}}^{4}}{-{{{5}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}} + {{{4}} {{{h}^{4}}}}}{{{4}} {{{h}^{4}}}}& \frac{{{{{\bar{x}}^{3}}} {{{h}^{3}}}}{-{{{{\bar{x}}^{4}}} {{{h}^{2}}}}}{-{{{4}} {{\bar{x}}} \cdot {{{h}^{5}}}}} + {{{4}} {{{\bar{x}}^{2}}} {{{h}^{4}}}}}{{{6}} {{{h}^{6}}}}& \frac{{-{{{2}} {{{\bar{x}}^{3}}} {{{h}^{3}}}}}{-{{{{\bar{x}}^{2}}} {{{h}^{4}}}}} + {{{{\bar{x}}^{4}}} {{{h}^{2}}}} + {{{2}} {{\bar{x}}} \cdot {{{h}^{5}}}}}{{{24}} {{{h}^{6}}}}\\ \frac{{{h}^{3}}{-{{{2}} {{{\bar{x}}^{3}}}}} + {{{\bar{x}}} \cdot {{{h}^{2}}}}{-{{{3}} {{h}} {{{\bar{x}}^{2}}}}}}{{{12}} {{{h}^{4}}}}& \frac{{{{4}} {{{\bar{x}}^{3}}}}{-{{{4}} {{{h}^{3}}}}} + {{{3}} {{h}} {{{\bar{x}}^{2}}}}{-{{{8}} {{\bar{x}}} \cdot {{{h}^{2}}}}}}{{{6}} {{{h}^{4}}}}& \frac{{{\bar{x}}} \cdot {{\left({{-{{{2}} {{{\bar{x}}^{2}}}}} + {{{5}} {{{h}^{2}}}}}\right)}}}{{{2}} {{{h}^{4}}}}& \frac{{{{4}} {{{\bar{x}}^{3}}}} + {{{4}} {{{h}^{3}}}}{-{{{3}} {{h}} {{{\bar{x}}^{2}}}}}{-{{{8}} {{\bar{x}}} \cdot {{{h}^{2}}}}}}{{{6}} {{{h}^{4}}}}& \frac{{-{{h}^{3}}}{-{{{2}} {{{\bar{x}}^{3}}}}} + {{{\bar{x}}} \cdot {{{h}^{2}}}} + {{{3}} {{h}} {{{\bar{x}}^{2}}}}}{{{12}} {{{h}^{4}}}}\\ \frac{{-{{h}^{4}}} + {{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}} + {{{6}} {{\bar{x}}} \cdot {{{h}^{3}}}}}{{{24}} {{{h}^{6}}}}& \frac{{{{4}} {{{h}^{4}}}}{-{{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}}{-{{{3}} {{\bar{x}}} \cdot {{{h}^{3}}}}}}{{{6}} {{{h}^{6}}}}& \frac{{-{{{5}} {{{h}^{4}}}}} + {{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}}{{{4}} {{{h}^{6}}}}& \frac{{{{4}} {{{h}^{4}}}}{-{{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}} + {{{3}} {{\bar{x}}} \cdot {{{h}^{3}}}}}{{{6}} {{{h}^{6}}}}& \frac{{-{{h}^{4}}} + {{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}{-{{{6}} {{\bar{x}}} \cdot {{{h}^{3}}}}}}{{{24}} {{{h}^{6}}}}\\ -{\frac{{h} + {{{2}} {{\bar{x}}}}}{{{12}} {{{h}^{4}}}}}& \frac{{h} + {{{4}} {{\bar{x}}}}}{{{6}} {{{h}^{4}}}}& -{\frac{\bar{x}}{{h}^{4}}}& \frac{{-{h}} + {{{4}} {{\bar{x}}}}}{{{6}} {{{h}^{4}}}}& \frac{{h}{-{{{2}} {{\bar{x}}}}}}{{{12}} {{{h}^{4}}}}\\ \frac{1}{{{24}} {{{h}^{4}}}}& -{\frac{1}{{{6}} {{{h}^{4}}}}}& \frac{1}{{{4}} {{{h}^{4}}}}& -{\frac{1}{{{6}} {{{h}^{4}}}}}& \frac{1}{{{24}} {{{h}^{4}}}}\end{array}\right]}} {{\left[\begin{array}{c} {y_{1}}\\ {y_{2}}\\ {y_{3}}\\ {y_{4}}\\ {y_{5}}\end{array}\right]}}}$

${{p(x)} = {{{{x^j}}} \cdot {{{\mathbf{A}}^{-1}}} {{{y_i}}}}} = {{{\left[\begin{array}{ccccc} 1& x& {x}^{2}& {x}^{3}& {x}^{4}\end{array}\right]}} {{\left[\begin{array}{ccccc} \frac{{{{2}} {{{\bar{x}}^{3}}} {{{h}^{3}}}}{-{{{{\bar{x}}^{2}}} {{{h}^{4}}}}} + {{{{\bar{x}}^{4}}} {{{h}^{2}}}}{-{{{2}} {{\bar{x}}} \cdot {{{h}^{5}}}}}}{{{24}} {{{h}^{6}}}}& \frac{{-{{{{\bar{x}}^{3}}} {{{h}^{3}}}}}{-{{{{\bar{x}}^{4}}} {{{h}^{2}}}}} + {{{4}} {{\bar{x}}} \cdot {{{h}^{5}}}} + {{{4}} {{{\bar{x}}^{2}}} {{{h}^{4}}}}}{{{6}} {{{h}^{6}}}}& \frac{{{\bar{x}}^{4}}{-{{{5}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}} + {{{4}} {{{h}^{4}}}}}{{{4}} {{{h}^{4}}}}& \frac{{{{{\bar{x}}^{3}}} {{{h}^{3}}}}{-{{{{\bar{x}}^{4}}} {{{h}^{2}}}}}{-{{{4}} {{\bar{x}}} \cdot {{{h}^{5}}}}} + {{{4}} {{{\bar{x}}^{2}}} {{{h}^{4}}}}}{{{6}} {{{h}^{6}}}}& \frac{{-{{{2}} {{{\bar{x}}^{3}}} {{{h}^{3}}}}}{-{{{{\bar{x}}^{2}}} {{{h}^{4}}}}} + {{{{\bar{x}}^{4}}} {{{h}^{2}}}} + {{{2}} {{\bar{x}}} \cdot {{{h}^{5}}}}}{{{24}} {{{h}^{6}}}}\\ \frac{{{h}^{3}}{-{{{2}} {{{\bar{x}}^{3}}}}} + {{{\bar{x}}} \cdot {{{h}^{2}}}}{-{{{3}} {{h}} {{{\bar{x}}^{2}}}}}}{{{12}} {{{h}^{4}}}}& \frac{{{{4}} {{{\bar{x}}^{3}}}}{-{{{4}} {{{h}^{3}}}}} + {{{3}} {{h}} {{{\bar{x}}^{2}}}}{-{{{8}} {{\bar{x}}} \cdot {{{h}^{2}}}}}}{{{6}} {{{h}^{4}}}}& \frac{{{\bar{x}}} \cdot {{\left({{-{{{2}} {{{\bar{x}}^{2}}}}} + {{{5}} {{{h}^{2}}}}}\right)}}}{{{2}} {{{h}^{4}}}}& \frac{{{{4}} {{{\bar{x}}^{3}}}} + {{{4}} {{{h}^{3}}}}{-{{{3}} {{h}} {{{\bar{x}}^{2}}}}}{-{{{8}} {{\bar{x}}} \cdot {{{h}^{2}}}}}}{{{6}} {{{h}^{4}}}}& \frac{{-{{h}^{3}}}{-{{{2}} {{{\bar{x}}^{3}}}}} + {{{\bar{x}}} \cdot {{{h}^{2}}}} + {{{3}} {{h}} {{{\bar{x}}^{2}}}}}{{{12}} {{{h}^{4}}}}\\ \frac{{-{{h}^{4}}} + {{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}} + {{{6}} {{\bar{x}}} \cdot {{{h}^{3}}}}}{{{24}} {{{h}^{6}}}}& \frac{{{{4}} {{{h}^{4}}}}{-{{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}}{-{{{3}} {{\bar{x}}} \cdot {{{h}^{3}}}}}}{{{6}} {{{h}^{6}}}}& \frac{{-{{{5}} {{{h}^{4}}}}} + {{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}}{{{4}} {{{h}^{6}}}}& \frac{{{{4}} {{{h}^{4}}}}{-{{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}} + {{{3}} {{\bar{x}}} \cdot {{{h}^{3}}}}}{{{6}} {{{h}^{6}}}}& \frac{{-{{h}^{4}}} + {{{6}} {{{\bar{x}}^{2}}} {{{h}^{2}}}}{-{{{6}} {{\bar{x}}} \cdot {{{h}^{3}}}}}}{{{24}} {{{h}^{6}}}}\\ -{\frac{{h} + {{{2}} {{\bar{x}}}}}{{{12}} {{{h}^{4}}}}}& \frac{{h} + {{{4}} {{\bar{x}}}}}{{{6}} {{{h}^{4}}}}& -{\frac{\bar{x}}{{h}^{4}}}& \frac{{-{h}} + {{{4}} {{\bar{x}}}}}{{{6}} {{{h}^{4}}}}& \frac{{h}{-{{{2}} {{\bar{x}}}}}}{{{12}} {{{h}^{4}}}}\\ \frac{1}{{{24}} {{{h}^{4}}}}& -{\frac{1}{{{6}} {{{h}^{4}}}}}& \frac{1}{{{4}} {{{h}^{4}}}}& -{\frac{1}{{{6}} {{{h}^{4}}}}}& \frac{1}{{{24}} {{{h}^{4}}}}\end{array}\right]}} {{\left[\begin{array}{c} {y_{1}}\\ {y_{2}}\\ {y_{3}}\\ {y_{4}}\\ {y_{5}}\end{array}\right]}}}$

let ${\bar{x}} = {x}$
${\frac{\partial p(x)}{\partial x}} \approx {{{\frac{1}{h}}} {{{\frac{1}{12}}{\left({{{y_{1}}}{-{{y_{5}}}}{-{{{8}} {{{y_{2}}}}}} + {{{8}} {{{y_{4}}}}}}\right)}}}}$

${\frac{\partial p(x)}{\partial x}} \approx {{{\frac{1}{h}}} {{\left[\begin{array}{ccccc} \frac{1}{12}& -{\frac{2}{3}}& 0& \frac{2}{3}& -{\frac{1}{12}}\end{array}\right]}} {{\left[\begin{array}{c} {y_{1}}\\ {y_{2}}\\ {y_{3}}\\ {y_{4}}\\ {y_{5}}\end{array}\right]}}}$

Numericaly:


...2 order


${A} = {\left[\begin{array}{ccc} 1& -1& 1\\ 1& 0& 0\\ 1& 1& 1\end{array}\right]}$
${det(A)} = {2}$
${{A}^{-1}} = {\left[\begin{array}{ccc} 0& 1& 0\\ -{\frac{1}{2}}& 0& \frac{1}{2}\\ \frac{1}{2}& -{\frac{2}{2}}& \frac{1}{2}\end{array}\right]}$
${{{{A}^{-1}}} {{x}}} = {\left[\begin{array}{ccc} -{\frac{1}{2}}& 0& \frac{1}{2}\end{array}\right]}$

...4 order


${A} = {\left[\begin{array}{ccccc} 1& -2& 4& -8& 16\\ 1& -1& 1& -1& 1\\ 1& 0& 0& 0& 0\\ 1& 1& 1& 1& 1\\ 1& 2& 4& 8& 16\end{array}\right]}$
${det(A)} = {288}$
${{A}^{-1}} = {\left[\begin{array}{ccccc} 0& 0& 1& 0& 0\\ \frac{1}{12}& -{\frac{2}{3}}& 0& \frac{2}{3}& -{\frac{1}{12}}\\ -{\frac{1}{24}}& \frac{2}{3}& -{\frac{5}{4}}& \frac{2}{3}& -{\frac{1}{24}}\\ -{\frac{1}{12}}& \frac{1}{6}& 0& -{\frac{3}{18}}& \frac{1}{12}\\ \frac{1}{24}& -{\frac{1}{6}}& \frac{1}{4}& -{\frac{1}{6}}& \frac{1}{24}\end{array}\right]}$
${{{{A}^{-1}}} {{x}}} = {\left[\begin{array}{ccccc} \frac{1}{12}& -{\frac{2}{3}}& 0& \frac{2}{3}& -{\frac{1}{12}}\end{array}\right]}$

...6 order


${A} = {\left[\begin{array}{ccccccc} 1& -3& 9& -27& 81& -243& 729\\ 1& -2& 4& -8& 16& -32& 64\\ 1& -1& 1& -1& 1& -1& 1\\ 1& 0& 0& 0& 0& 0& 0\\ 1& 1& 1& 1& 1& 1& 1\\ 1& 2& 4& 8& 16& 32& 64\\ 1& 3& 9& 27& 81& 243& 729\end{array}\right]}$
${det(A)} = {24883200}$
${{A}^{-1}} = {\left[\begin{array}{ccccccc} 0& 0& 0& 1& 0& 0& 0\\ -{\frac{1}{60}}& \frac{3}{20}& -{\frac{3}{4}}& 0& \frac{3}{4}& -{\frac{3}{20}}& \frac{1}{60}\\ \frac{1}{180}& -{\frac{3}{40}}& \frac{3}{4}& -{\frac{49}{36}}& \frac{3}{4}& -{\frac{3}{40}}& \frac{1}{180}\\ \frac{1}{48}& -{\frac{1}{6}}& \frac{13}{48}& 0& -{\frac{13}{48}}& \frac{1}{6}& -{\frac{1}{48}}\\ -{\frac{1}{144}}& \frac{1}{12}& -{\frac{13}{48}}& \frac{7}{18}& -{\frac{13}{48}}& \frac{2}{24}& -{\frac{1}{144}}\\ -{\frac{1}{240}}& \frac{1}{60}& -{\frac{1}{48}}& 0& \frac{1}{48}& -{\frac{80}{4800}}& \frac{1}{240}\\ \frac{1}{720}& -{\frac{1}{120}}& \frac{1}{48}& -{\frac{1}{36}}& \frac{1}{48}& -{\frac{1}{120}}& \frac{1}{720}\end{array}\right]}$
${{{{A}^{-1}}} {{x}}} = {\left[\begin{array}{ccccccc} -{\frac{1}{60}}& \frac{3}{20}& -{\frac{3}{4}}& 0& \frac{3}{4}& -{\frac{3}{20}}& \frac{1}{60}\end{array}\right]}$

...8 order


${A} = {\left[\begin{array}{ccccccccc} 1& -4& 16& -64& 256& -1024& 4096& -16384& 65536\\ 1& -3& 9& -27& 81& -243& 729& -2187& 6561\\ 1& -2& 4& -8& 16& -32& 64& -128& 256\\ 1& -1& 1& -1& 1& -1& 1& -1& 1\\ 1& 0& 0& 0& 0& 0& 0& 0& 0\\ 1& 1& 1& 1& 1& 1& 1& 1& 1\\ 1& 2& 4& 8& 16& 32& 64& 128& 256\\ 1& 3& 9& 27& 81& 243& 729& 2187& 6561\\ 1& 4& 16& 64& 256& 1024& 4096& 16384& 65536\end{array}\right]}$
${det(A)} = {5056584744960000}$
${{A}^{-1}} = {\left[\begin{array}{ccccccccc} 0& 0& 0& 0& 1& 0& 0& 0& 0\\ \frac{1}{280}& -{\frac{4}{105}}& \frac{1}{5}& -{\frac{4}{5}}& 0& \frac{4}{5}& -{\frac{2}{10}}& \frac{4}{105}& -{\frac{1}{280}}\\ -{\frac{1}{1120}}& \frac{4}{315}& -{\frac{1}{10}}& \frac{4}{5}& -{\frac{205}{144}}& \frac{4}{5}& -{\frac{1}{10}}& \frac{4}{315}& -{\frac{1}{1120}}\\ -{\frac{7}{1440}}& \frac{1}{20}& -{\frac{169}{720}}& \frac{61}{180}& 0& -{\frac{61}{180}}& \frac{169}{720}& -{\frac{1}{20}}& \frac{7}{1440}\\ \frac{7}{5760}& -{\frac{1}{60}}& \frac{169}{1440}& -{\frac{61}{180}}& \frac{91}{192}& -{\frac{61}{180}}& \frac{169}{1440}& -{\frac{1}{60}}& \frac{7}{5760}\\ \frac{1}{720}& -{\frac{1}{80}}& \frac{13}{360}& -{\frac{29}{720}}& 0& \frac{29}{720}& -{\frac{13}{360}}& \frac{1}{80}& -{\frac{1}{720}}\\ -{\frac{1}{2880}}& \frac{1}{240}& -{\frac{13}{720}}& \frac{29}{720}& -{\frac{5}{96}}& \frac{29}{720}& -{\frac{13}{720}}& \frac{1}{240}& -{\frac{1}{2880}}\\ -{\frac{1}{10080}}& \frac{1}{1680}& -{\frac{1}{720}}& \frac{1}{720}& 0& -{\frac{60}{43200}}& \frac{1}{720}& -{\frac{3780}{6350400}}& \frac{1}{10080}\\ \frac{1}{40320}& -{\frac{1}{5040}}& \frac{1}{1440}& -{\frac{1}{720}}& \frac{1}{576}& -{\frac{1}{720}}& \frac{1}{1440}& -{\frac{1}{5040}}& \frac{1}{40320}\end{array}\right]}$
${{{{A}^{-1}}} {{x}}} = {\left[\begin{array}{ccccccccc} \frac{1}{280}& -{\frac{4}{105}}& \frac{1}{5}& -{\frac{4}{5}}& 0& \frac{4}{5}& -{\frac{2}{10}}& \frac{4}{105}& -{\frac{1}{280}}\end{array}\right]}$

...10 order


${A} = {\left[\begin{array}{ccccccccccc} 1& -5& 25& -125& 625& -3125& 15625& -78125& 390625& -1953125& 9765625\\ 1& -4& 16& -64& 256& -1024& 4096& -16384& 65536& -262144& 1048576\\ 1& -3& 9& -27& 81& -243& 729& -2187& 6561& -19683& 59049\\ 1& -2& 4& -8& 16& -32& 64& -128& 256& -512& 1024\\ 1& -1& 1& -1& 1& -1& 1& -1& 1& -1& 1\\ 1& 0& 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1\\ 1& 2& 4& 8& 16& 32& 64& 128& 256& 512& 1024\\ 1& 3& 9& 27& 81& 243& 729& 2187& 6561& 19683& 59049\\ 1& 4& 16& 64& 256& 1024& 4096& 16384& 65536& 262144& 1048576\\ 1& 5& 25& 125& 625& 3125& 15625& 78125& 390625& 1953125& 9765625\end{array}\right]}$