Math Insight

Introduction to multi-dimensional discrete systems and matrices

Math 2241, Spring 2016
Name:
ID #:
Due date: Feb. 3, 2016, 11:59 p.m.
Table/group #:
Group members:
Total points: 3
  1. Consider a discrete dynamical system with two state variables, perhaps describing populations sizes of two species. Let's call the state variables $x$ and $y$, and denote their values at the $n$-th time step by $x_{n+1}$ and $y_{n+1}$. Suppose they obey the following (linear) dynamical rule for $n=0, 1, \ldots$: \begin{align*} x_{n+1} &= 3.5 x_{n} - y_{n}\\ y_{n+1} &= x_{n} + y_{n} \end{align*}
    1. If we start with the initial condition $x_0=1$ and $y_0 = 1$, iterate the model for 1 time step to calculate $x_1$ and $y_1$. $x_1= $
      , $y_1=$
    2. Iterate the model for a second time step to calculate that $x_2=$
      and $y_2=$
      .
    3. Starting with the initial condition $(x_0,y_0) = (2,1)$, iterate the model for two times steps to calculate $(x_1,y_1)$ and $(x_2,y_2)$.

      $(x_1,y_1) = $
      , $(x_2,y_2)=$

  2. The general form of the linear discrete dynamical system in two variables can be written as \begin{align*} x_{n+1} &= a x_n + b y_n, \qquad \text{for $n=0,1,2,\ldots$} \\ y_{n+1} &= c x_n + d y_n \end{align*}
    1. The one-dimensional analogue of this dynamical system is $z_{n+1}=a z_n$. Recall that the behavior of this system is dictated by the parameter $a$: If $|a|<$
      , then $z_n$ approaches zero as $n$ increases, whereas if $|a|>$
      , $|z_n|$ approaches infinity as $n$ increases. We want to find a way to understand the two-dimensional system in a similar way, but we now have four parameters instead of one. What are the four parameters?

      The starting point for analyzing the behavior of the two-dimensional system is re-writing it in a format similar to the one-dimensional system. We want to write it as a single equation, where the state variables at time $n+1$ are equal to one "parameter" times the state variables at time $n$. To do this, we use vectors and matrices. We start by writing the state variables as a vector. We will use two formats for writing vectors. Either $$(x_n, y_n)$$ or $$\begin{bmatrix} x_n\\ y_n \end{bmatrix}$$ will denote the vector of state variables. Typically, the first format will be used when we are discussing the vector in isolation. The second format will be used when a matrix is involved.

      Our objective is now to write the two-dimensional dynamical system as $$\begin{bmatrix} x_{n+1}\\ y_{n+1} \end{bmatrix}=A\begin{bmatrix} x_n\\ y_n \end{bmatrix}$$ To determine the matrix $A$, we need to understand matrix-vector multiplication.

    2. Recall that a matrix with $m$ rows and $n$ columns can be multiplied by a vector with $n$ components. For each row, we take each entry and multiply by the corresponding component in the vector, then add them up. Doing this for each row yields a vector with $m$ components. For example, consider $$\displaystyle \begin{bmatrix} 4 & 2 & -1 \\ 3 & 2 & 5 \end{bmatrix} \begin{bmatrix} 2 \\ -1 \\ 1 \end{bmatrix}$$ The resulting product is a vector with
      components. The first component is given by

      $\cdot$
      $+$
      $\cdot$
      $+$
      $\cdot$
      $=$

      and the second component is given by

      $\cdot$
      $+$
      $\cdot$
      $+$
      $\cdot$
      $=$

      Note: for these, make sure the first term in each product comes from the matrix, and the order of the products matches the order of the entries in the matrix/vector.
    3. Now we can use this to convert the two-dimensional dynamical system into a matrix equation. When we multiply the matrix by the vector $(x_n, y_n)$, we want the first component to be the right-hand side of the first equation, $x_{n+1} = a x_n + b y_n$. Similarly, the second component should be the right-hand side of the second equation, $y_{n+1} = c x_n + d y_n$. Enter the appropriate parameters below to form the matrix equation.

      $\displaystyle\begin{bmatrix} x_{n+1}\\ y_{n+1} \end{bmatrix}=$




      $\displaystyle\begin{bmatrix} x_{n}\\ y_{n} \end{bmatrix}$

  3. Compute the following matrix-vector products.
    1. $\displaystyle \left[\begin{matrix}4 & 3\\2 & -1\end{matrix}\right]\left[\begin{matrix}3\\-2\end{matrix}\right]=$
    2. $\displaystyle \left[\begin{matrix}5 & 3 & -2\\1 & 4 & 1\\2 & -1 & 3\end{matrix}\right]\left[\begin{matrix}4\\5\\2\end{matrix}\right]=$
    3. $\displaystyle \left[\begin{matrix}-2 & 4 & 2\\3 & 1 & 4\\-1 & 1 & 3\end{matrix}\right]\left[\begin{matrix}2\\-1\\2\end{matrix}\right]=$

  4. Rewrite the following discrete dynamical systems as matrix equations.
    1. \begin{eqnarray*} u_{n+1} & = & 3u_n+7v_n\\ v_{n+1} & = & 4u_n-3v_n \end{eqnarray*}

      $\displaystyle\begin{bmatrix} u_{n+1}\\ v_{n+1} \end{bmatrix}=$




      $\displaystyle\begin{bmatrix} u_{n}\\ v_{n} \end{bmatrix}$
    2. \begin{eqnarray*} x_{n+1} & = & 2x_n-3y_n+z_n\\ y_{n+1} & = & -x_n+2y_n+4z_n\\ z_{n+1} & = & -3x_n+y_n-2z_n \end{eqnarray*}

      $\displaystyle\begin{bmatrix} x_{n+1}\\ y_{n+1}\\z_{n+1} \end{bmatrix}=$









      $\displaystyle\begin{bmatrix} x_{n}\\ y_{n} \\z_n \end{bmatrix}$
    3. \begin{eqnarray*} x_{n+1} & = & x_n+2y_n-3z_n+4w_n\\ y_{n+1} & = & 2x_n-y_n+2z_n-w_n\\ z_{n+1} & = & 3x_n+2y_n-5z_n+w_n\\ w_{n+1} & = & -x_n+3y_n+2z_n+5w_n \end{eqnarray*}

      $\displaystyle\begin{bmatrix} x_{n+1}\\ y_{n+1}\\z_{n+1}\\w_{n+1} \end{bmatrix}=$
















      $\displaystyle\begin{bmatrix} x_{n}\\ y_{n} \\z_n\\w_n \end{bmatrix}$

  5. One reason to write linear dynamical systems in terms of matrix-vector multiplication is that we can determine the behavior of the dynamical system by analyzing the matrix, as we'll see later. For now, let's just take advantage of the ability of computers to calculate matrix-vector products and use the matrix-vector form of the dynamical system to simulate it.

    Let's revisit the dynamical system from the first problem. above: \begin{align*} x_{n+1} &= 3.5 x_{n} - y_{n}, \qquad \text{for $n=0,1,2, \ldots$}\\ y_{n+1} &= x_{n} + y_{n} \end{align*} Rewrite this dynamical system in terms of a matrix-vector product:


    $\displaystyle\begin{bmatrix} x_{n+1}\\ y_{n+1} \end{bmatrix}=$




    $\displaystyle\begin{bmatrix} x_{n}\\ y_{n} \end{bmatrix}$

    Let's call this matrix $A$, so that we can write the dynamical system as \begin{gather*} \vc{x}_{n+1} = A\vc{x}_n, \qquad \text{for $n=0,1,2,\ldots$} \end{gather*} where \begin{align*} A = \begin{bmatrix}_&_\\_&_\end{bmatrix} \qquad \text{and} \qquad \vc{x}_n = \begin{bmatrix} x_{n}\\ y_{n} \end{bmatrix}. \end{align*}

    The matrix equation $\vc{x}_{n+1} = A \vc{x}_n$ is shorthand for many equations, one for $n=0$, one for $n=1$, etc. The specific versions for $n=0$ and $n=1$ give the equations for $\vc{x}_1$ and $\vc{x}_2$:
    $\vc{x}_1=$
    , $\vc{x}_2 = $

    As in the first problem, above, we'll use the initial condition $\vc{x}_0 = \left[\begin{matrix}1\\1\end{matrix}\right]$ to calculate $\vc{x}_1$ and $\vc{x}_2$. This time, since we've rewritten the dynamical system as a matrix-vector multiplication, we can easily ask the computer to do the work for us with the programing language R.

    To enter the matrix $A$ in R, type the following command:

    
    A=matrix(c(_, _, _, _), 2, 2, byrow=TRUE)
    
    
    The first argument is the vector of numbers we want in the matrix and the next two numbers give the matrix dimensions. The argument byrow=TRUE tells R we want to fill the matrix by rows (like in the order you'd read a matrix) rather than down the columns, which is the R default.

    Once you've entered that command in the console, you can just enter A in the console to view the matrix and make sure it turned out as you expected. R also outputs row and column headings like [,1] to show you the index corresponding to each row and column.

    Create the initial condition vector by entering x0 = c(1,1) in the console. The next step is to tell R that we want $\vc{x}_1 = A \vc{x}_0$. Caution: we cannot use the command x1 = A*x0 in R. Instead, in R, A*x0 means to multiply the components of $A$ with the components of $\vc{x}_0$ (recycling the components of $\vc{x}_0$ since there are fewer components). The correct command for calculating $\vc{x}_1$ in R is

    x1 = A %*% x0
    You can then calculate $\vc{x}_2$ by typing the similar command x2 = A %*% x1 in the console. Follow the same pattern to calculate the iteration all the way to $\vc{x}_{10}$.

    The result is:
    $\vc{x}_1 =$
    , $\vc{x}_2 =$
    , $\vc{x}_{10} =$