Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help with matrices

  1. Mar 19, 2007 #1
    I have this system :
    [tex](A_1 \quad A_2 \quad A_3 \;...)\left( {\matrix{
    {b_1 } \cr
    {b_2 } \cr
    {b_3 } \cr
    {...} \cr
    } } \right) = C[/tex]

    where the A's are matrices that forms a vector, b is a vector and C a matrix. If I know C and the A's. How can I find the b's?

    [tex]\left( {\matrix{
    {b_1 } \cr
    {b_2 } \cr
    {b_3 } \cr
    {...} \cr

    } } \right) = (A_1^{ - 1} \quad A_2^{ - 1} \quad A_3^{ - 1} \;...)C
    [/tex]

    Surely not, this give another matrix. The A's are square but not necessarely invertable...
     
    Last edited by a moderator: Mar 19, 2007
  2. jcsd
  3. Mar 19, 2007 #2

    radou

    User Avatar
    Homework Helper

    You'll have to be a bit more specific about the types of your vectors/matrices.
     
  4. Mar 19, 2007 #3
    A's and B are n x n real matrices...
     
  5. Mar 19, 2007 #4

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    There is no B in what you wrote. But there are (so far undefined) bi's and a C.


    And currently, that expression is gibberish. On the left hand side, your multiplicand is a 1x? array, and your multiplier is a 1x? array. (Why don't you tell us the number of entries?) But multiplication is only defined when the number of columns in the multiplicand equals the number of rows in the multiplier.

    And unless the bi's happen to be nx1 arrays, multiplication of the individual elements of your two big arrays doesn't make sense.



    Oh, I've looked at your source code, I think you meant:

    [tex]
    \left(
    \begin{array}{c c c}
    A_1 & A_2 & \cdots
    \end{array}
    \right)
    \cdot
    \left(
    \begin{array}{c}
    b_1 \\
    b_2 \\
    \vdots
    \end{array}
    \right)
    = C
    [/tex]

    (click the image to see how to draw it yourself)


    This is better, since this multiplication is defined (assuming each bi is an nx1 array of numbers, and C is an nx1 array of numbers, and each ellipsis represents the same number of omitted entries). All you have to do is to forget the partitions; this is an ordinary matrix * vector = vector problem. The solution (if one exists) won't be unique, though.
     
    Last edited: Mar 19, 2007
  6. Mar 19, 2007 #5
    sorry, should have been C...

    In fact, the A's represents the gradient of a magnetic field over a given array of current carrying coils. Each coil carry a current b. The A's are numerically computed and I already know the final C. So I have to find the b currents...
    Hope that helps...

    Yes, that is what I meant. But each A is a matrix. So this is not a simple matrix*vector=vector problem, it's more of
    a sum over i(matrix(i)*scalar(i))=matrix...
     
    Last edited: Mar 19, 2007
  7. Mar 19, 2007 #6

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    (see the addition to my previous post)
     
  8. Mar 19, 2007 #7

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Incidentally, if you want to keep it in block form, then you can just find one A that's invertible, then you can multiply by its inverse.

    For example, if I have
    [tex]
    \left(
    \begin{array}{c c c}
    A & B & C
    \end{array}
    \right)
    \cdot
    \left(
    \begin{array}{c}
    x \\ y \\ z
    \end{array}
    \right)
    = v
    [/tex]

    and A is invertible, then I can left multiply by its inverse:


    [tex]
    \left(
    \begin{array}{c c c}
    I & A^{-1}B & A^{-1}C
    \end{array}
    \right)
    \cdot
    \left(
    \begin{array}{c}
    x \\ y \\ z
    \end{array}
    \right)
    = A^{-1}v
    [/tex]

    and I can read off the solutions in the same way I would for the ordinary case -- my pivot was the first column, so I can pick any value I want for y and z, and then x is uniquely determined.

    If none of A, B, or C are invertible, then you have to do some tricky stuff to stay in the block form.
     
  9. Mar 19, 2007 #8
    This is a better formulation of the problem:

    [tex]\sum\limits_{i = 1}^N {A_i } b_i \; = \;C[/tex]

    ...each [tex]A_i[/tex] is a matrix...

    solution is not unique, but I'm trying to find the b's that minimize:

    [tex]C - \sum\limits_{i = 1}^N {A_i } b_i \; [/tex]
     
    Last edited: Mar 19, 2007
  10. Mar 19, 2007 #9

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    That's why you have to say what things are -- I would never have guessed that the bi's were scalars!


    If you were looking to actually solve that system, then you can turn it into a matrix * vector = vector problem with some rearranging. I'll demonstrate on a smaller example:

    If you have the equation
    [tex]
    x
    \left(
    \begin{array}{cc}
    1 & 2 \\
    3 & 4
    \end{array}
    \right)
    +
    y
    \left(
    \begin{array}{cc}
    5 & 6 \\
    7 & 8
    \end{array}
    \right)
    =
    \left(
    \begin{array}{cc}
    9 & 10 \\
    11 & 12
    \end{array}
    \right)
    [/tex]

    then the matrix structure is irrelevant: it's just an array of 4 numbers, and this can be unfolded into a system of four scalar equations. Refolding them into a matrix * vector = vector product, you have:

    [tex]
    \left(
    \begin{array}{cc}
    1 & 5 \\
    2 & 6 \\
    3 & 7 \\
    4 & 8
    \end{array}
    \right)
    \left(
    \begin{array}{c}
    x \\ y
    \end{array}
    \right)
    =
    \left(
    \begin{array}{c}
    9 \\
    10 \\
    11 \\
    12
    \end{array}
    \right)
    [/tex]


    But you seem to suggest that you don't want to solve it, but approximately solve it. Well, you'll have to first come up with a metric on the solution space. I suspect you'll first need to convert the problem into a matrix * vector = vector problem, as I did above. A common way to measure how close a solution is, is simply the length of the error vector:

    If we're trying to solve Ax = b, and we have a candidate solution y, then the (squared) error is given by

    [tex]e(y)^2= ||Ay - b||^2 = (Ay - b)^T(Ay - b) = y^T A^T A y - b^T A y - y^T A^T b + b^T b
    = y^T A^T A y - 2 y^T A^T b + b^T b
    [/tex]


    To minimize, we set the derivative to zero:

    [tex]0 = 2 A^T A y - 2 A^T b[/tex]

    which means that the "best" solution to Ax = b is the actual solution to

    [tex]A^T A y = A^T b[/tex]
     
    Last edited: Mar 19, 2007
  11. Mar 19, 2007 #10
    Yes, thank you. I didn't think of the unfolding procedure. This will help.
    The part with the error I already knew, but it's okay. So to find the b's, I could now try to invert A or try to find it's pseudo-invert?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Help with matrices
  1. Matrices (Replies: 2)

Loading...