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

Successive matrix multiplication

  1. Feb 9, 2008 #1
    On a given day of a flu epidemic, a given percentage Y of the population is ill and (1-Y) is healthy. The probability of remaining healthy on the next day is a, and that of remaining sick is B. The question is, what percentage will be ill after a given number of days as a function of B,a and Y.

    Write down the problem as a matrix multiplication of the vector of healthy and ill people. Define a MATLAB function that gives the percentage of ill people after n days for arbitrary B a,and Y.

    any hints will be appreciated v much
    thank you
  2. jcsd
  3. Feb 10, 2008 #2
    # healthy people = # people staying healthy + # new healthy people

    The odds of staying healthy are a, so
    # people staying healthy = a * # healthy people

    New healthy people are sick people who did not stay sick. The odds of staying sick are B, so the odds of NOT remaining sick, i.e. new healthy people is (1-B), so
    # new healthy people = (1-B) * # sick people

    So if Y is the number of healthy people and X is the number of sick people at a given time,
    Y[n+1] = a*Y[n] + (1-B)*X[n]

    Write down a similar equation for X[n+1]. Do you see how this can be written as a matrix-vector product?
  4. Feb 10, 2008 #3
    would the equation for X[n+1] be:

    i understood everything you did but i'm struggling to write it as a matrix vector product.
    would it be something like:
    (X,Y)=(somthing with a)+(something with b)
    thank you
  5. Feb 10, 2008 #4
    You want to write

    \begin{bmatrix} A_{11} & A_{12} \\ A_{21} & A_{22} \end{bmatrix}
    \begin{bmatrix} X_n \\ Y_n \end{bmatrix} =
    \begin{bmatrix} X_{n+1} \\ Y_{n+1} \end{bmatrix}

    Multiplying this out gives

    \begin{array}{c} X_{n+1} \\ Y_{n+1} \end{array} =
    \begin{array}{cc} A_{11}X[n] + A_{12}Y[n] \\ A_{21}X[n] + A_{22}Y[n] \end{array}

    so find the coefficients for the A matrix that make this match your equations.
  6. Feb 10, 2008 #5
    oh ok so A(21) would be=(1-B)
    and A(22) would be=a
    is that right?
    and how do i find A(11) and A(12) because i'm not so convinced about my equation for X[n+1]??
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook