## Posts Tagged ‘Finite Dynamical Systems’

### Linear dynamical systems over finite rings II

July 28, 2011

Last week, we studied some properties of the following finite linear dynamical system

$\left[\begin{array}{cc} x_1^+\\ x_2^+\end{array}\right] = \left[\begin{array}{cc} 2 & 3\\ 1 & 0\\\end{array}\right] \left[\begin{array}{c} x_1 \\ x_2\\\end{array}\right]$

where $x := (x_1, x_2)$ lives in $\mathbb{Z}_4^2$, where $\mathbb{Z}_4 := \{0, 1, 2, 3\}$. Let $A \in \mathbb{Z}_4^{2 \times 2}$ be defined by

$A := \left[\begin{array}{cc} 2 & 3\\ 1 & 0\\\end{array}\right]$

so that we can rewrite the state update equation as $x^+ = A x$.

In the 1st installment, we obtained qualitative information about the dynamical system from visual inspection of its state transition diagram, which is clearly impossible for finite dynamical systems with state sets of sufficiently large cardinality. Thus, in this post, we will study the same dynamical system using only algebra. The goal is to see how far we can go without knowing what the state transition diagram looks like.

Before we embark on this journey, please take a good look at the addition and multiplication tables of the finite ring $(\mathbb{Z}_4, +, \times)$

__________

Time reversibility

Suppose there exists a matrix $B \in \mathbb{Z}_4^{2 \times 2}$ such that $B A = I$, where $I \in \mathbb{Z}_4^{2 \times 2}$ is the identity matrix. Then, left-multiplying both sides of the state update equation by $B$, we obtain $B x^+ = B A x = I x$, which is equivalent to $x = B x^+$. Hence, if matrix $B$ exists, we can propagate the state backwards in time, and the dynamical system is time reversible.

Matrix equation $B A = I$ can be written as

$\left[\begin{array}{cc} b_{11} & b_{12}\\ b_{21} & b_{22}\\\end{array}\right] \left[\begin{array}{cc} 2 & 3\\ 1 & 0\\\end{array}\right] = \left[\begin{array}{cc} 1 & 0\\ 0 & 1\\\end{array}\right]$

and, vectorizing both sides, we obtain a linear system of equations $(A^T \otimes I)\, \mbox{vec}(B) = \mbox{vec}(I)$, i.e., we have

$\left[\begin{array}{cccc} 2 & 0 & 1 & 0\\ 0 & 2 & 0 & 1\\ 3 & 0 & 0 & 0\\ 0 & 3 & 0 & 0\\\end{array}\right] \left[\begin{array}{c} b_{11}\\ b_{21}\\ b_{12}\\ b_{22}\\\end{array}\right] = \left[\begin{array}{c} 1\\ 0\\ 0\\ 1\\\end{array}\right]$

From the 4th and last equation, $3 b_{21} = 1$, we get $b_{21} = 3$, as $3 \times 3 = 1$ in modulo 4 arithmetic. From the 3rd equation, $3 b_{11} = 0$, we get $b_{11} = 0$. The 2nd equation, $2 b_{21} + b_{22} = 0$, becomes then $2 + b_{22} = 0$, which yields $b_{22} = 2$. Finally, the 1st equation, $2 b_{11} + b_{12} = 1$, becomes $b_{12} = 1$. Let us define $A^{-1} := B$. Hence, we have

$A^{-1} = \left[\begin{array}{cc} 0 & 1\\ 3 & 2\\\end{array}\right]$

which is the (left and right) inverse of matrix $A$. We then have the (backwards in time) state update equation $x = A^{-1} x^+$. If we draw the state transition diagram for this linear dynamical system, we obtain the diagram we obtained last week, but with the direction of the arrows reversed. If you do not believe me, then define $g (x) := A^{-1} x$  and run the following Python script:

# define function g
def g (x):
g1 = x[1] % 4
g2 = (3 * x[0] + 2 * x[1]) % 4
return (g1, g2)

print "State transitions:\n"
for x1 in [0,1,2,3]:
for x2 in [0,1,2,3]:
print "g(%d,%d) = (%d,%d)" % (x1, x2, g((x1,x2))[0], g((x1,x2))[1])


__________

Fixed points

As mentioned last week, we can find fixed points of the dynamical system $x^+ = A x$ by solving the equation $A x = x$. Since $-1 = 3$ in modulo 4 arithmetic, let us add $3 x$ to both sides of the equation, which yields $(A + 3 I) x = 0_2$, i.e.,

$\left[\begin{array}{cc} 1 & 3\\ 1 & 3\end{array}\right] \left[\begin{array}{c} x_1\\ x_2 \end{array}\right] = \left[\begin{array}{c} 0\\ 0 \end{array}\right]$

and, since one of the equations is redundant, we are left with $x_1 + 3 x_2 = 0$, which is equivalent to $x_1 = x_2$. The set of fixed points is, thus,

$\{ (0,0), (1,1), (2,2), (3,3)\}$.

Fixed points are periodic points of period equal to 1. Let us now find periodic points of period greater than 1.

__________

Periodic points of period equal to 2

To find periodic points of period equal to 2, we must solve the equation $A^2 x = x$, where

$A^2 = \left[\begin{array}{cc} 3 & 2\\ 2 & 3\\\end{array}\right]$.

Once again, let us add $3 x$ to both sides of the equation, which yields $(A^2 + 3 I) x = 0_2$, i.e.,

$\left[\begin{array}{cc} 2 & 2\\ 2 & 2\end{array}\right] \left[\begin{array}{c} x_1\\ x_2 \end{array}\right] = \left[\begin{array}{c} 0\\ 0 \end{array}\right]$

and, eliminating the redundant equation, we are left with $2 x_1 + 2 x_2 = 0$. Since $-2 = 2$ in modulo 4 arithmetic, we finally obtain the equation $2 x_1 = 2 x_2$. If we were solving equations over $\mathbb{R}$, we could just multiply both sides of $2 x_1 = 2 x_2$ by $1 / 2$ and obtain $x_1 = x_2$. However, we are working with the finite ring $(\mathbb{Z}_4, +, \times)$, for which the element 2 does not have a multiplicative inverse! Let us write the equation for various values of $x_2$:

• if $x_2 = 0$, then we obtain the equation $2 x_1 = 0$, which yields $x_1 \in \{0, 2\}$. We thus have points $(0, 0)$ and $(2,0)$.
• if $x_2 = 1$, then we obtain the equation $2 x_1 = 2$, which yields $x_1 \in \{1, 3\}$. We thus have points $(1, 1)$ and $(3,1)$.
• if $x_2 = 2$, then we obtain the equation $2 x_1 = 0$, which yields $x_1 \in \{0, 2\}$. We thus have points $(0, 2)$ and $(2,2)$.
• if $x_2 = 3$, then we obtain the equation $2 x_1 = 2$, which yields $x_1 \in \{1, 3\}$. We thus have points $(1, 3)$ and $(3,3)$.

To summarize, we have eight periodic points of period equal to 2

$\{ (0,0), (2,0), (1,1), (3,1), (2,2), (0,2), (3,3), (1,3)\}$

of which, 4 points are fixed points. Removing these fixed points, we are left with 4 periodic points of fundamental period equal to 2

$\{ (2,0), (3,1), (0,2), (1,3)\}$.

We finally conclude that the finite dynamical system under study has two cycles of length equal to 2, namely

$(2,0) \mapsto (0,2) \mapsto (2,0)$

$(3,1) \mapsto (1,3) \mapsto (3,1)$

__________

Periodic points of period equal to 3

To find periodic points of period equal to 3, we must solve the equation $A^3 x = x$, where

$A^3 = \left[\begin{array}{cc} 0 & 1\\ 3 & 2\\\end{array}\right]$.

Note that $A^3 = A^{-1}$. Hence, $A^4 = A^{-1} A = I$, and $A^5 = A$. In order to solve equation $A^3 x = x$, let us (yet once again) add $3 x$ to both sides of the equation, which yields $(A^3 + 3 I) x = 0_2$, i.e.,

$\left[\begin{array}{cc} 3 & 1\\ 3 & 1\end{array}\right] \left[\begin{array}{c} x_1\\ x_2 \end{array}\right] = \left[\begin{array}{c} 0\\ 0 \end{array}\right]$

and, eliminating the redundant equation, we are left with $3 x_1 + x_2 = 0$. Since $-1 = 3$ in modulo 4 arithmetic, we finally obtain the equation $3 x_1 = 3 x_2$. Fortunately, element 3 has a multiplicative inverse, which is itself (as $3 \times 3 = 1$). Multiplying both sides by 3, we obtain $x_1 = x_2$, an equation we solved already when looking for the fixed points. Since the only solutions of this equation are the four fixed points, we conclude that there are no periodic points of fundamental period equal to 3, i.e., there are no cycles of length 3.

__________

Periodic points of period equal to 4

To find periodic points of period equal to 4, we must solve the equation $A^4 x = x$. Nevertheless, we know that $A^4 = I$ and, hence, $A^4 x = x$ reduces to $x = x$, which is satisfied by every $x \in \mathbb{Z}_4^2$, of course. In other words, every single point in the state set is a periodic point of period equal to 4. Some of them have fundamental period equal to 1, some others have fundamental period equal to 2. Removing from the state set these two sets, we are left with the periodic points of fundamental period equal to 4

$\{ (1,0), (2,1), (3,2), (0,3), (3,0), (2,3), (1,2), (0,1)\}$.

We finally conclude that the finite dynamical system under study has two cycles of length equal to 4, namely

$(1,0) \mapsto (2,1) \mapsto (3,2) \mapsto (0,3) \mapsto (1,0)$

$(3,0) \mapsto (2,3) \mapsto (1,2) \mapsto (0,1) \mapsto (3,0)$

The hunt for periodic points is over. Since $A^5 = A$, equation $A^5 x = x$ reduces to equation $A x = x$, which we already solved. Likewise, $A^6 x = x$ boils down to $A^2 x = x$, which we already solved too. We have found all the cycles.

__________

Concluding remarks

All the qualitative information about the finite dynamical system that we were able to obtain by taking a look at the state transition diagram can instead be obtained algebraically.

Last week, we found the solutions of the equations $A^k x = x$ using sheer brute force, i.e., via exhaustive search over the entire state set. By contrast, in this post we actually did solve the equations using algebra. Intuitively, the latter should be computationally cheaper. If this is correct, then the question is: how much cheaper?

### Linear dynamical systems over finite rings

July 18, 2011

Consider the following linear dynamical system (example 3.4 in [1])

$\left[\begin{array}{cc} x_1^+\\ x_2^+\end{array}\right] = \left[\begin{array}{cc} 2 & 3\\ 1 & 0\\\end{array}\right] \left[\begin{array}{c} x_1 \\ x_2\\\end{array}\right]$

where the state vector $x := (x_1, x_2)$ travels in the finite state space $\mathbb{Z}_4^2$, where $\mathbb{Z}_4 := \{0, 1, 2, 3\}$. Since the state space is finite, let us henceforth call it state set. Let $A \in \mathbb{Z}_4^{2 \times 2}$ be defined by

$A := \left[\begin{array}{cc} 2 & 3\\ 1 & 0\\\end{array}\right]$

so that we can write the state update equation in the more compressed form $x^+ = A x$. For simplicity, let us introduce function $f : \mathbb{Z}_4^2 \to \mathbb{Z}_4^2$ defined by $f (x) := A x$. Hence, we have $x^+ = f (x)$.

Do note that we are working with the finite ring $(\mathbb{Z}_4, +, \times)$, whose addition and multiplication tables are as follows

and, therefore, when we update each state via $x_i^+ = a_{i1} x_1 + a_{i2} x_2$, we use addition and multiplication modulo 4.

When we study discrete-time dynamical systems over $\mathbb{R}$, we are usually interested in finding equilibrium points, fixed points and limit cycles. For dynamical systems over a finite ring, what are the properties of interest? And how can one study them?

__________

State transition graph

The state set, $\mathbb{Z}_4^2$, which has $4^2 = 16$ elements, is a subset of the 2-dimensional integer lattice $\mathbb{Z}^2$, as depicted below

Computing $x^+ = f(x)$ for each $x$ in the state set and forming ordered pairs $(x, f(x))$, we can build the state transition graph, whose vertex set is the state set $\mathbb{Z}_4^2$, and whose edge set is the set $\{(x, f(x))\}_{x \in \mathbb{Z}_4^2}$. A pictorial representation of this graph is shown below

Note that the out-degree of each vertex is 1. This is due to the fact that function $f$ maps states to states, not states to sets of states. In other words, we do not allow non-determinism.

Visual inspection of the state transition diagram allows us to conclude that, interestingly, the in-degree of each vertex is also 1, i.e., function $f$ is injective and surjective. Thus, $f$ is invertible, which means that the dynamical system we are studying is time reversible! Switch the direction of each arrow in the diagram, and we obtain a new state transition diagram. Hence, if are given the state at a certain time step, we can determine the entire history of the system, both past and future!

A state $x$ is a fixed point if $f(x) = x$, i.e., if $x^+ = x$. Taking a look at the state transition diagram, we see that there are four vertices with self-loops, which means that the system has four fixed points

$\{ (0,0), (1,1), (2,2), (3,3)\}$.

If the system starts at a fixed point $x$, it will remain there forever

$x \mapsto f(x) = x \mapsto f(x) = x \mapsto \dots$

and, thus, the set of all fixed points is an invariant set. Note that a fixed point is a periodic point of period equal to 1.

Observing the state transition diagram again, we notice the existence of loops of various lengths. We have two loops of length equal to 2 and two loops of length equal to 4, depicted below in blue and magenta, respectively

Do note, however, that we also have four loops of length equal to 1, which are the self-loops corresponding to the fixed points, but we already mentioned those.

For the dynamical system under study, we could obtain qualitative information about its behavior by visual inspection of its state transition diagram. Suppose, for example, that we want to study a dynamical system whose state set is $\mathbb{Z}_4^{16}$, which has over four billion states. It is evident that drawing diagrams and counting loops is an approach that does not scale! Can one use Algebra to obtain qualitative information about the dynamical system being studied?

__________

Finding periodic points

If state $x$ is a fixed point, then $f (x) = x$ or, equivalently, $A x = x$, as we defined $f (x) := A x$. Hence, we can find fixed points by solving the equation $A x = x$.

A state $x$ is a periodic point of period equal to $k$ if $f^{(k)} (x) = x$, where $f^{(k)} = f \circ f^{(k-1)}$ and $f^{(1)} = f$. Since $f (x) := A x$, we have that $f^{(k)} (x) = A^k x$. Thus, we can find periodic points of period equal to $k$ by solving the equation $A^k x = x$.

However, do note that fixed points, i.e., periodic points of period equal to 1, are also periodic points of period equal to 2, equal to 3, equal to 4, etc. Therefore, let the fundamental period be the smallest natural number $k$ for which $A^k x = x$. For example, the set of all periodic points of fundamental period equal to 2 is

$\{x \in \mathbb{Z}_4^2 \mid A^2 x = x \land A x \neq x\}$

and the set of all periodic points of fundamental period equal to 3 is

$\{x \in \mathbb{Z}_4^2 \mid A^3 x = x \land A x \neq x\}$.

However, the periodic points of period equal to 2 are also periodic points of period equal to 4. Hence, the set of periodic points of fundamental period equal to 4 is

$\{x \in \mathbb{Z}_4^2 \mid A^4 x = x \land A^2 x \neq x \land A x \neq x\}$.

But, how do we solve equations of the form $A^k x = x$ over the ring $(\mathbb{Z}_4, +, \times)$? A possibility is to search the whole state set and find the states for which the equations hold. That is precisely what the following Python script does:

# define function f
def f (x):
f1 = (2 * x[0] + 3 * x[1]) % 4
f2 = x[0] % 4
return (f1, f2)

# create state set
X = []
for x1 in [0,1,2,3]:
for x2 in [0,1,2,3]:
X.append((x1,x2))

print "State transitions:\n"
for x in X:
x1, x2, f1, f2 = x[0], x[1], f(x)[0], f(x)[1]
print "f(%d,%d) = (%d,%d)" % (x1, x2, f1, f2)

# find periodic points of fundamental periods 1, 2, 3, 4
PP1, PP2, PP3, PP4 = [], [], [], []
for x in X:
if f(x) == x:
PP1.append(x)
elif f(f(x)) == x:
PP2.append(x)
elif f(f(f(x))) == x:
PP3.append(x)
elif f(f(f(f(x)))) == x:
PP4.append(x)

print "\nLists of periodic points:\n"
print "\nFundamental period equal to 1:\n %s" % PP1
print "\nFundamental period equal to 2:\n %s" % PP2
print "\nFundamental period equal to 3:\n %s" % PP3
print "\nFundamental period equal to 4:\n %s" % PP4


The output of this script is the following:

State transitions:

f(0,0) = (0,0)
f(0,1) = (3,0)
f(0,2) = (2,0)
f(0,3) = (1,0)
f(1,0) = (2,1)
f(1,1) = (1,1)
f(1,2) = (0,1)
f(1,3) = (3,1)
f(2,0) = (0,2)
f(2,1) = (3,2)
f(2,2) = (2,2)
f(2,3) = (1,2)
f(3,0) = (2,3)
f(3,1) = (1,3)
f(3,2) = (0,3)
f(3,3) = (3,3)

Lists of periodic points:

Fundamental period equal to 1:
[(0, 0), (1, 1), (2, 2), (3, 3)]

Fundamental period equal to 2:
[(0, 2), (1, 3), (2, 0), (3, 1)]

Fundamental period equal to 3:
[]

Fundamental period equal to 4:
[(0, 1), (0, 3), (1, 0), (1, 2), (2, 1), (2, 3), (3, 0), (3, 2)]


Note that there are no periodic points of fundamental period equal to 3, as a quick glance at the state transition diagram will tell.

__________

References

[1] O. Colón-Reyes, A. Jarrah, R. Laubenbacher, B. Sturmfels, Monomial Dynamical Systems over Finite Fields, May 2006.