Linear Algebra question (system of equations)

In summary, the problem involves finding the average temperature at 25 points on a grid, where the temperature at each point is dependent on the temperature of the neighboring points. This results in a system of 25 equations, which can be represented as a 25x25 matrix. The constants are added to the variables in the equations, and the solution can be found using the command x=A\b.
  • #1

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: [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.

Help please? :)
Last edited by a moderator:
Physics news on
  • #2
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:
  • #3
Thanks for your fast reply!

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 :(
  • #4
Do you know how matrix multiplication works...
  • #5
Yes I do. Ax gives me a 25x25 matrix

only if i arrange the equations in a single row in A
  • #6
When you have a linear equation Ax=b

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?

  • #7
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

Can you write down all the equations and make a matrix equation out of it?
  • #8
*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...

On it!

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:
  • #9
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?
  • #10
Ortix said:
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?

Step 1: write out the equations (or at least as many of them as you need to see the pattern).
Step 2: convert the equations to matrix form (if you need to).

Whether or not you can skip Step 2 depends on how your software likes to see its input. For example, in Maple we can just leave the 25 equations in 25 unknowns in their original form, and ask for a solution, so converting to matrix form is a waste of time. Similarly, if you solve the equations using the EXCEL Solver tool (or similar tools in other spreadsheets) you don't need the matrix---and, in fact, getting the matrix is a useless step. I don't have access to Matlab, so don't know what is requires.

  • #11

1. What is a system of equations in linear algebra?

A system of equations in linear algebra is a set of equations that are related to each other and involve the same set of variables. The goal is to find the values of these variables that satisfy all of the equations in the system simultaneously.

2. How do you solve a system of equations in linear algebra?

There are several methods for solving a system of equations in linear algebra, including substitution, elimination, and matrix operations. These methods involve manipulating the equations to eliminate variables and eventually arrive at a solution.

3. What is the importance of solving systems of equations in linear algebra?

Solving systems of equations in linear algebra is important because it allows us to solve real-world problems that involve multiple unknown variables. It is also a fundamental concept in many areas of mathematics and science, such as engineering, physics, and economics.

4. Can a system of equations have more than one solution?

Yes, a system of equations can have more than one solution. This is known as an infinite number of solutions. In this case, the equations are not enough to determine a unique solution and there are multiple sets of values that satisfy the system.

5. What happens if a system of equations has no solution?

If a system of equations has no solution, it means that there is no set of values for the variables that satisfy all of the equations in the system. This can happen when the equations are contradictory or when there are more equations than unknown variables.

Suggested for: Linear Algebra question (system of equations)