1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Linear Algebra question (system of equations)

  1. Nov 23, 2011 #1
    1. The problem statement, all variables and given/known data

    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.

    Help please? :)
     
    Last edited by a moderator: May 5, 2017
  2. jcsd
  3. Nov 23, 2011 #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: Nov 23, 2011
  4. Nov 23, 2011 #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 :(
     
  5. Nov 23, 2011 #4
    Do you know how matrix multiplication works...
     
  6. Nov 23, 2011 #5
    Yes I do. Ax gives me a 25x25 matrix

    edit:
    only if i arrange the equations in a single row in A
     
  7. Nov 23, 2011 #6
    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?

    ...
     
  8. Nov 23, 2011 #7

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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?
     
  9. Nov 23, 2011 #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...
    [/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: Nov 23, 2011
  10. Nov 23, 2011 #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?
     
  11. Nov 23, 2011 #10

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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.

    RGV
     
  12. Nov 25, 2011 #11
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook