# 8.13 Cryptography

Τεχνίτη Νοημοσύνη και Ρομποτική

21 Νοε 2013 (πριν από 4 χρόνια και 5 μήνες)

121 εμφανίσεις

8.13 Cryptography

Introduction

Secret writing

means
code
.

A simple code

Let the letters a, b, c,

., z be represented by the
numbers 1, 2, 3,

, 26. A sequence of letters cab
then be a sequence of numbers. Arrange these
numbers into an
m

n
matrix
M
. Then we select a
nonsingular
m

m
matrix
A
. The new sent message
becomes
Y
=
AM
, then
M
=
A
-
1
Y
.

8.14 An Error Correcting Code

Parity Encoding

Add an extra bit to make the number of one is
even

Example 2

(a)
W

= (1 0 0 0 1 1) (b)
W

= (1 1 1 0 0 1)

Solution

(a) The extra bit will be 1 to make the number of
one is 4 (even).

The code word is then
C

= (1 0 0 0 1 1 1).

(b) The extra bit will be 0 to make the number of
one is 4 (even).

So the edcoded word is C = (1 1 1 0 0 1 0).

Fig 8.12

Example 3

Decoding the following

(a)
R

= (1 1 0 0 1 0 1)

(b)
R

= (1 0 1 1 0 0 0)

Solution

(a) The number of one is 4 (even), we just drop the
last bit to get (1 1 0 0 1 0).

(b) The number of one is 3 (odd). It is a parity error.

Hamming Code

where
c
1
,
c
2
, and
c
3

denote the parity check bits.

)
(
4
3
2
3
1
2
1
w
w
w
c
w
c
c

C
)
(
4
3
2
1
w
w
w
w

W
Encoding

4
3
2
3
4
3
1
2
4
2
1
1
w
w
w
c
w
w
w
c
w
w
w
c

4
3
2
1
3
2
1
1
1
1
0
1
1
0
1
1
0
1
1
w
w
w
w
c
c
c
Example 4

Encode the word W = (1 0 1 1).

Solution

,
1
,
0
,
1
3
2
1

w
w
w
1
4

w

0
1
0
1
1
1
1
0
1
1
0
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
0
1
1
3
2
1

c
c
c
0
,
1
,
0
3
2
1

c
c
c
)
1
1
0
0
1
1
0
(

C
Decoding

0
HR
S

T
Example 5

Compute the syndrome of (a) R = (1 1 0 1 0 0
1) and (b) R = (1 0 0 1 0 1 0)

Solution

(a)

we conclude that R is a code word. By the check
bits in (
1

1

0
1

0 0 1), we get the decoded
message (0 0 0 1).

0
0
0
1
0
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
1
1
1
0
0
0
S
Example 5 (2)

(b)

Since
S

0
R

is not a code
word.

1
1
0
0
1
0
1
0
0
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
1
1
1
0
0
0
S
]
[
7
6
5
4
3
2
1
e
e
e
e
e
e
e

E
bit
th

the
change
ot

does

noise

if
bit
th

the
changes

noise

if
,
0
,
1
i
i
e
i

T
T
T
T
T
T
T
HE
HE
0
HE
HC
E
C
H
HR

)
(
,
E
C
R

T
T
T
E
C
R

7
5
3
1
7
6
3
2
7
6
5
4
e
e
e
e
e
e
e
e
e
e
e
e
T
HE

1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
0
1
0
1
0
0
7
6
5
4
3
2
1
e
e
e
e
e
e
e
T
HE
Example 6

Changing zero to one gives the code word
C

= (1
0 1 1 0 1 0). Hence the first, second, and
fourth bits from
C

we arrive at the decoded
message (1 0 1 0).

)
0
1
0
1
0
0
1
(

R

1
1
0
S
8.15 Method of Least Squares

Example 2

If we have the data (1, 1), (2, 3), (3, 4), (4, 6),
(5,5), we want to fit the function
f
(
x
)

=ax + b.
Then

a + b =
1

2
a + b =
3

3
a + b =
4

4
a + b =
6

5
a + b =
5

Example 2 (2)

Let

we have

,
5
6
4
3
1

Y

1
5
1
4
1
3
1
2
1
1
A

5
15
15
55
A
A
T
Example 2 (3)

5
.
0
1
.
1
19
68
55
15
15
5
50
1
5
6
4
3
1
1
1
1
1
1
5
4
3
2
1
55
15
15
5
50
1
5
6
4
3
1
1
5
1
4
1
3
1
2
1
1
5
15
15
55
1
T
X
Example 2 (4)

We have
AX

=
Y
. Then the best solution of
X
will
be
X

= (
A
T
A
)
-
1
A
T
Y
= (1.1, 0.5)
T
.
For this line the
sum of the square error is

The fit function is

y =
1.1
x +
0.5

7
.
2
]
6
5
[
]
9
.
4
6
[
]
8
.
3
4
[
]
7
.
2
3
[
]
6
.
1
1
[
)]
5
(
5
[
)]
4
(
6
[
)]
3
(
4
[
)]
2
(
3
[
)]
1
(
1
[
2
2
2
2
2
2
2
2
2
2

f
f
f
f
f
E
Fig 8.15

8.16 Discrete Compartmental Models

The General Two
-
Compartment Model

)
(
)
(
)
(
)
(
)
(
)
(
)
(
2
20
21
1
21
2
21
1
10
12
t
c
F
F
t
c
F
dt
dy
t
I
t
c
F
t
c
F
F
dt
dx

Fig 8.16

Discrete Compartmental Model

n
n
y
y
y
x
x
x

2
1
2
1
,
Y
X

n
n
n
n
n
n
x
x
x
x
x
x
x
x
x
y
1
2
12
1
1
31
21
1
1
31
21
1
3
13
2
12
1
1
1
)
1
(
)
(
)
(
)
1

leaving
tracer
of
amount
(
)
1

entering
tracer
of
amount
(

n
nn
n
n
n
n
n
n
n
x
x
x
y
x
x
x
y
x
x
x
y

2
2
1
1
2
2
22
1
21
2
1
2
12
1
11
1

n
nn
n
n
n
n
n
x
x
x
y
y
y

2
1
2
1
2
22
21
1
12
11
2
1

Fig 8.17

Example 1

See Fig 8.18. The initial amount is 100, 250, 80
for these three compartment.

For Compartment 1 (C1):

20% to C2

0% to C3

then

80% to C1

For C2:

5% to C1

30% to C3

then

65% to C2

For C3:

25% to C1

0% to C3

then

75% to C3

3
.
0
0
0
2
.
0
25
.
0
05
.
0
T
Fig 8.18

That is,

New C1 = 0.8C1 + 0.05C2 + 0.25C3

New C2 = 0.2C1 + 0.65C2 + 0C3

New C3 = 0C1 + 0.3C2 + 0.75C3

We get the transfer matrix as

75
.
0
3
.
0
0
0
65
.
0
2
.
0
25
.
0
05
.
0
8
.
0
T
Example 1 (2)

Example 1 (3)

Then one day later,

135
5
.
182
5
.
112
80
250
100
75
.
0
3
.
0
0
0
65
.
0
2
.
0
25
.
0
05
.
0
8
.
0
TX
Y

Note
:
m
days later,
Y

=
T
m
X
0

n
n
TX
X
TX
X
TX
X
TX
X

1
2
3
1
2
0
1
,
,
,
,

,
)
(
,
)
(
0
3
0
2
3
0
2
0
2
X
T
X
T
X
X
T
TX
T
X

,
2
,
1
,
0

n
n
n
X
T
X
Example 2

Example 2 (2)

20
15
60
20
0
X

1
0
01
.
0
0
0
8
.
0
0
1
.
0
0
2
.
0
98
.
0
05
.
0
0
0
01
.
0
85
.
0
T
Example 2 (3)

6
.
20
0
.
14
8
.
62
6
.
17
20
15
60
20
1
0
01
.
0
0
0
8
.
0
0
1
.
0
0
2
.
0
98
.
0
05
.
0
0
0
01
.
0
85
.
0
0
1
TX
X
Para la matriz sim
é
trica:

tenemos

=

9, −9, 9.

8
1
4
1
8
4
4
4
7
A

0
0
0
0
0
0
0
0
0
4
1/
1/4
1
filas
s
operacione
0
0
0
1
1
4
1
1
4
4
4
16
)
0
9
(
I
A

0
4
1
,
1
1
0
2
1
K
K
3
2
1
4
1
4
1
k
k
k

0
0
0
0
0
0
0
0
0
4
0
1
filas
s
operacione
0
0
0
17
1
4
1
17
4
4
4
2
)
0
9
(
I
A

0
1
4
3
K
2
1
4
k
k

Recuerda que si
A

es una matriz
n

×

n

simétrica, los autovectores
correspondientes a
distintos
(diferentes)

autovalores
son ortogonales.

Observa que:

K
3

K
1

=
K
3

K
2

= 0,
K
1

K
2

=

4

0

Usando el m
é
todo de Gram
-
Schmidt:
V
1

=
K
1

Ahora si que tenemos un conjunto ortogonal y podemos
normalizarlo:

2
2
1
1
1
1
1
2
2
2
V
V
V
V
K
K
V

2
3
1
2
3
1
2
3
4
,
3
2
3
2
3
1
,
2
1
2
1
0

2
3
1
3
2
2
1
2
3
1
3
2
2
1
2
3
4
3
1
0
P
Ortogonal