# Solving a system of linear equations

Hi

I have obtain two third degree polynomials p and q which are determint by the following conditions:

p(-1) = 1 , p'(-1) = 0

q(1) = 3 , q'(1) = 0

p(0) = q(0) , p'(0) = q'(0)

where p = a_1 * x^3 + b_1 *x^2 + c_1 *x + d_1
q = a_2 * x^3 + b_2 *x^2 + c_2 *x + d_2

I then end up with the the following linear equations by inserting the conditions into the equations above:

-a_1 + b_1 - c_1 + d_1 = 1

3* a_1 - 2 * b-1 + c_1 = 0

c_1 = d_1

3* a_2 + b_2 + c_2 + d_2 = 3

3 * a_2 + b_2 + c_2

d_1 = d_2

By the use of substitution I obtain the result, that

a_1 = 1/5 , b_1 = 34/5 , c_1 = d_1 = -15/5

My question is it correct to use substitution? If yes can I use approach to obtain a_2, b_2, c_2 and d_2 ???

Sincerley
Fred

NateTG
Homework Helper
I think your approach is, at least in principle, sound. However, it doesn't seem like you're getting the right equations.

You have:
$$p_1(x)=a_1x^3+b_1x^2+c_1x+d_1$$
and
$$p_2(x)=a_2x^3+b_2x^2+c_2x+d_2$$

Then you can convert your other conditions:
$$p_1(0)=p_2(0) \Rightarrow d_1=d_2$$
like you have, but I don't see
$$p_1'(0)=p_2'(0) \Rightarrow c_1=c_2$$
Which may be due to a transcription error. (I'm not going to speculate further on that.)

Moving on from there, you can certainly solve the system of equations using substitution, or some other method.

My problem concerns cubic splines. I'm suppose to determine two third degree polynomials p and q from the conditions given in my earlier post.

My linear Algebra book doesn't explain this process very well, so I would very much appricate if someone could direct me to a website which explains this process and which hopefully could contain a couple of examples.

Sincerely
Fred

NateTG said:
I think your approach is, at least in principle, sound. However, it doesn't seem like you're getting the right equations.

You have:
$$p_1(x)=a_1x^3+b_1x^2+c_1x+d_1$$
and
$$p_2(x)=a_2x^3+b_2x^2+c_2x+d_2$$

Then you can convert your other conditions:
$$p_1(0)=p_2(0) \Rightarrow d_1=d_2$$
like you have, but I don't see
$$p_1'(0)=p_2'(0) \Rightarrow c_1=c_2$$
Which may be due to a transcription error. (I'm not going to speculate further on that.)

Moving on from there, you can certainly solve the system of equations using substitution, or some other method.

NateTG
Homework Helper
When you've got a polynomial like
$$p(x)=ax^3+bx^2+cx+d$$
and something like
$$p(1)=5$$
you can just substitute the value in for x. I.e.
$$p(1) \equiv a1^3+b1^2+c1+d$$
You shouldn't have to deal with solving any kind of cubic to do this problem if you substitute in the x in all of the expressions.

HallsofIvy
Homework Helper
NateTG said:
I think your approach is, at least in principle, sound. However, it doesn't seem like you're getting the right equations.

You have:
$$p_1(x)=a_1x^3+b_1x^2+c_1x+d_1$$
and
$$p_2(x)=a_2x^3+b_2x^2+c_2x+d_2$$

Then you can convert your other conditions:
$$p_1(0)=p_2(0) \Rightarrow d_1=d_2$$
like you have, but I don't see
$$p_1'(0)=p_2'(0) \Rightarrow c_1=c_2$$
Which may be due to a transcription error. (I'm not going to speculate further on that.)
The original post (maybe it had been edited before I saw it)
said that p1[/sup]'(0)= 0, p2'(0)= 0
That would certainly give c1= 0, c2= 0!

You mean I need to put it into a matrix in order to solve it???

/Fred

NateTG said:
When you've got a polynomial like
$$p(x)=ax^3+bx^2+cx+d$$
and something like
$$p(1)=5$$
you can just substitute the value in for x. I.e.
$$p(1) \equiv a1^3+b1^2+c1+d$$
You shouldn't have to deal with solving any kind of cubic to do this problem if you substitute in the x in all of the expressions.

NateTG
Homework Helper
Mathman23 said:
You mean I need to put it into a matrix in order to solve it???

/Fred

Not really, no. (Although that is an option.) There are many different ways to solve systems of linear equations.

If you have
$$p(1)=5$$
and
$$p(x)=ax^3+bx^2+cx+d$$
then you have
$$5=p(1)=a1^3+b1^2+c1+d=a+b+c+d$$
so
$$5=a+b+c+d$$

What I mean is that in order to solve your system, you don't need any cubics or quadratics since you can just substitute in to get a linear system of equations in the cooeficients.

Hi

If I assume that $c_{1} = c_{2} = d_{1} = d_{2}=0$

Then the system of equations is reduced to:

$1 = -a_{1} + b_{1}$

$0 = 3a_{1} - 2b_{1}$

$3 = a_{2} + b_{2}$

$0 = 3a_{2} + 2b_{2}$

I then solve the above as two systems of equations and then obtain the following values $a_{1}= 2 , b_{1} = 3 , b_{2} = -6 , a_{2} = 9$

This in turn generates two 3 degree polynomials: $p(x) = 2 x^{3} + 3x^2$ and $q(x) = -6 x^{3} + 9 x^{2}$

Finally I preform a test by inserting the values: p(-1) = 1, q(1) = 3, p(0) = q(0), p'(-1) = 0, q'(1) = 0, p'(0) = q'(0) into their respective polynomials.

I then discover that the polynomials give the desired result mentioned above.

My question is: Doesn't that mean that my approach is correct???

Sincerley
Fred

NateTG
Homework Helper
Mathman23 said:
My question is: Doesn't that mean that my approach is correct???

You have found a solution to the system of equations. Since you have 6 equations, and 8 unknowns, there will be an infinite number of solutions, or no solutions at all.

p(-1) = 1,
p'(-1) = 0,
q(1) = 3,
q'(1) = 0,
p(0) = q(0),
p'(0) = q'(0)
$$p(x)=a_1x^3+b_1x^2+c_1x+d_1$$
$$q(x)=a_2x^3+b_2x^2+c_2x+d_2$$
So, chose any $$c,d$$ that you like. Then:
$$c_1=c_2=c$$
$$d_1=d_2=d$$
$$a_1=c-2d+2$$
$$b_1=2c-3d+3$$
$$a_2=2c+2d-6$$
$$b_2=9-3c-3d$$
Is going to solve your system of equations.