# Linear Algebra - Finding coordinates of a set

Tags:
1. Feb 20, 2017

### cscott0001

1. The problem statement, all variables and given/known data

Find the coordinates of each member of set S relative to B.
B = {1, cos(x), cos2(x), cos3(x), cos4(x), cos5(x)}
S = {1, cos(x), cos(2x), cos(3x), cos(4x), cos(5x)}

I am to do this using Mathematica software. Each spanning equation will need to be sampled at six separate points to create a 6x6 system that solves for the coordinates of each element of S.

2. Relevant equations

Ax = b
If I was given a simpler problem, such as "Find the coordinate vector of w = (1, 0) relative to the basis S = {u, v}, u = (2, 2) and v = (1, 1)" my equation would start:

(1, 0) = k1(2, 2) + k2(1, 1)

and I'd solve for k1 and k2

3. The attempt at a solution

I started with the equation S = kB, where k is a constant, but I was told to build a 6x6 matrix by sampling each member of B at six points, so I knew that's wasn't right. I built a 6x6 matrix from B with columns 1-6 filled with evaluations of B with x = {0, pi/6, pi/4, pi/3, pi/2, pi}, but I don't think that's right either, because I didn't create any spanning equations. I tried using a matrix {{1,0,0,0,,00},{0,cos(x),0,0,0,0}...{0,0,0,0,0,cos5(x)}}, to test for span, but that didn't feel right either. How do I create spanning equations to sample to build the matrix?

2. Feb 20, 2017

### pasmith

Given that $$\cos (n \pm 1)x = \cos nx \cos x \mp \sin nx \sin x$$ we obtain $$\cos (n+1)x = 2\cos x \cos nx - \cos(n-1)x.$$ From this recurrence relation you can express $\cos nx$ as a polynomial in $\cos x$, which gives you a matrix equation $$(1, \cos x, \dots, \cos 5x)^{T} = A (1, \cos x, \dots, \cos^5 x)$$ and your problem is to invert $A$.

3. Feb 20, 2017

### Math_QED

So, what you actually need to do is write all the elements of S as linear combinations of elements of B. For example:

$1 = 1*1 + 0*cos(x) + 0*cos^2(x) + 0*cos^3(x) + 0*cos^4(x) + 0*cos^5(x)$

Thus, the coordinates of $1$ relative to $B$ is $(1,0,0,0,0,0)$.

Another example:

$cos(2x) = cos^2(x) - sin^2(x) = cos^2(x) - (1 - cos^2(x)) = -1 + 2cos^2(x)$

Thus, the coordinates of $cos(2x)$ relative to $B$ is $(-1,0,2,0,0,0)$

Now, try the rest of the exercise.

EDIT: I didn't read carefully about the mathematica part. You can ignore this post.