# Linear Algebra question (system of equations)

## Homework Statement

Ok I have been struggling a lot with this problem and I hope some of you might be able to help me out.

Let's take this image:
http://img822.imageshack.us/img822/3828/capturelqe.png [Broken]

All these dots labeled x1 to x25 are temperature points. All the dots along the edges of the main square are starting temperature values (all the 5 dots of one side have the same temperature) (the dots don't look connected at the side of B and C but they are)
A = 40
B = 0
C = 10
D = 40

Every point's temperature is dependent on the directly neighboring point's temperature. So the average temperature of a point is:

x1= 1/4(40+40+x2+x6)
x9= 1/4(x4+x8+x10+x14)

So now they are asking us to solve for all the points with MATLAB. I do have experience with matlab but I have no clue how to set up this system of equations even on paper.

I'm supposed to use Ax = y where A is a 25x25 matrix and y is an element or R^25

First of all I don't understand why A is a 25x25 matrix. Shouldn't it be a 5x5 matrix?

Furthermore I am also not sure what A, x or y needs to contain in this case. Of course I know how to solve regular system of equations. I've been doing this for a year now but the 25x25 matrix is just completely throwing me off.

Last edited by a moderator:

There are 25 variables. Therefore, the solution exists in ℝ25, so you need a 25×25 matrix to represent the solution.

It's not difficult to set up the matrix. You already set up two equations. Set up the equations for every point and assemble it into a matrix. Mat(rix)lab is designed to handle large matrices like these. Let Ax=b

A=[a(1)(1) a(1)(2) ...;a(2)(1) a(2)(2) ...; ... ;a(25)(1) a(25)(2) ... a(25)(25)]
(You can choose whether or not to put commas in between entries.)
b=[b1;b2; ... ;b25]
(Put semicolons between entries.)

The command x=A\b will give you the desired result.

Last edited:

So this would be my approach: set up each equation and end up with 25 equations. (this is where my linear algebra becomes blurry)

If I arrange these equations inside a matrix I would still end up with a 5x5 matrix... 5 rows and 5 columns which is equal to 25 equations.. right? I think i am completely missing something here.

Also, the x vector would just contain a single column starting at x1 going down to x25 right?

But what would y then be? Oh man this is killing me. The easiest stuff is always the hardest :(

Do you know how matrix multiplication works...

Yes I do. Ax gives me a 25x25 matrix

edit:
only if i arrange the equations in a single row in A

When you have a linear equation Ax=b

A=[a1,a2,a3,a4,a5]
x=[x1;x2;x3;x4;x5]
where an is the nth column of A and xn is the nth entry of the vector x,

Ax = [x1a1+x2a2+x3a3+x4a4+x5a5]

How many entries are in each column of A? 5? or 25?

...

Office_Shredder
Staff Emeritus
Gold Member
2021 Award
Just because your grid is 5x5 doesn't mean that your matrix is going to be 5x5. You might want to start with an easier example

Suppose you have six points arranged in a line, and the temperature on the left side is 0 degrees and on the right side is 10 degrees, and the temperature at the points satisfies the averaging property, for example
x3=1/2*(x2+x4)

Can you write down all the equations and make a matrix equation out of it?

*facebrick*. I don't know why I said that Ax is a 25x25 matrix... I also just saw your first post edit (or i just blatantly missed it when i first read it...) [STRIKE]Ok I'm going to look for my book because I'm still kind of lost.

The problem says that A is a 25x25 matrix. From what I understand is that A contains the linear equations. x1 has a single equation x2 has a single equation etc etc which comes down to 25 equations. How does that make A a 25x25 matrix?

I really appreciate your help, i'm just struggling wrap my head around this.. I don't know why I'm having so much trouble with this because I passed the course...

Could you perhaps tell me what the first row would look like in my case? I'm sure I'll have a DOH moment...
[/STRIKE]
@Office_Shredder:

On it!

EDIT:
yeah I just had a DOH moment :P

The matrix will indeed be a 25x25 where most of the 'spaces' are zero since that variable does not exist in that equation. Am I right?

Last edited:
Ok so where do I put the constants? In your example, Office_Shredder, the constant 0 doesn't matter for x1 but what about for x6? Do I just add it to one of the variables?

Ray Vickson