# Thread: Algorithm for finding a matrix for the derivative of a function as a lin. transform

1. ## Algorithm for finding a matrix for the derivative of a function as a lin. transform

Basically I want to find a general algorithm that lets me, given any function y = f(x) (I'm not too worried about multivariable functions quite yet), I can come up with a matrix A so that x is mapped to f'(x). I want to do this so that I can sleep at night knowing that the solution to a linear ODE can be ygen= yhomogeneous + yparticular because derivatives are linear transforms. The moral of the story is that I want a solid understanding of why derivatives are linear transformations.

Sorry if this is a really stupid question to ask or pose.

Anthony

2. ## Re: Algorithm for finding a matrix for the derivative of a function as a lin. transfo

Hey cubejunkies.

Recall that is something is linear if f(x+y) = f(x) + f(y) and f(ax) = a*f(x). If you prove that both of these hold, you have proven linearity.

3. ## Re: Algorithm for finding a matrix for the derivative of a function as a lin. transfo

the problem is, most (real) function spaces are not finite-dimensional over R, that is, we need an infinite number of "basis functions". so you would need "infinite matrices" (at least).

as chiro points out, if D(f) is defined by: (D(f))(x) = f'(x) (for some suitable class of functions), we have:

(D(f+g))(x) = (f+g)'(x) = f'(x) + g'(x) = (D(f))(x) + (D(g))(x) = (D(f) + D(g))(x), hence D(f+g) = D(f) + D(g).

(D(af))(x) = (af)'(x) = a(f'(x)) = a[(D(f))(x)] = (aD(f))(x), so D(af) = aD(f), thus D is linear.

if we restrict ourselves to polynomial functions of degree equal to or less than n, we CAN write down an actual matrix (since this space IS finite-dimensional):

$D = \begin{bmatrix}0&1&0&0&\cdots&0 \\0&0&2&0&\cdots&0 \\0&0&0&3&\cdots&0\\ \vdots&\vdots&\vdots&\vdots&\ddots&\vdots\\ 0&0&0&0&\cdots&n-1\\0&0&0&0&\cdots&0 \end{bmatrix}$

this matrix is of rank n-1, which reflects the fact that when you differentiate a polynomial, "the degree goes down by one".

for all functions which have convergent Taylor series on some interval [a,b], we can approximate them by polynomials (if the convergence is slow, we may need a large "n" to be within ε).

often, a given linear ODE is of finite degree anyway, for example:

y" + ay' + by = g(x) which can be written:

D(D(y)) + a(D(y)) + by = g(x), or:

(D2 + aD + b)(y) = g(x).

suppose a given y0(x) satisfies this. then for ANY function y(x) for which: (D2 + aD + b)(y) = 0, we have:

(D2 + aD + b)(y + y0) = (D2 + aD + b)(y) + (D2 + aD + b)(y0) = 0 + g(x) = g(x).

this is entirely analogous to solving:

Ax = b. given a PARTICULAR x0 for which Ax0 = b, then for ANY x with Ax = 0:

A(x + x0) = A(x) + A(x0) = 0 + b = b.

note all we used was the LINEARITY of A, not the fact that it was "a matrix".

matrices are "concrete linear transformations", one we can actually crunch numbers on (they are a glorified form of arithmetic). they are not the ONLY linear transformations. many important vector spaces have infinite bases (a system of equations may have infinite degrees of freedom). function spaces are chief amongst these, there are more functions possible than dreamt of in your philosophy....