Let the threshold function be denoted by g(t)
a) OR
x1 | x2 | y |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
g(w1*0+w2*0+w3)=0 (x1=0,x2=0) g(w3)=0
...................(1)
g(w1*0+w2*1+w3)=1 (x1=0,x2=1) g(w2+w3)=1
...................(2)
g(w1*1+w2*0+w3)=1 (x1=1,x2=0) g(w1+w3)=1
...................(3)
g(w1*1+w2*1+w3)=1 (x1=1,x2=1)
g(w1+w2+w3)=1 ...................(4)
From (1), g(w3)=0 w3=0
From (2), g(w2+w3)=1 w2+w3>0
=> w2>0 w2=1
From (3), g(w1+w3)=1 w1+w3>0
=> w1>0 w1=1
Hence. w1=1,w2=1,w3=0
These can be verified by putting in (4)
a) AND
x1 | x2 | y |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
g(w1*0+w2*0+w3)=0 (x1=0,x2=0) g(w3)=0
...................(1)
g(w1*0+w2*1+w3)=0 (x1=0,x2=1) g(w2+w3)=0
...................(2)
g(w1*1+w2*0+w3)=0 (x1=1,x2=0) g(w1+w3)=0
...................(3)
g(w1*1+w2*1+w3)=1 (x1=1,x2=1)
g(w1+w2+w3)=1 ...................(4)
From (1), g(w3)=0 w3=-1 as
w3=0 will not satisfy equation (4).
From (2), g(w2+w3)=0 w2+w3<=0
w2+(-1)<=0 w2=1 as
w2=0,-1 will not satisfy equation (4).
From (3), g(w1+w3)=0 w1+w3<=0
w1+(-1)<=0 w1=1 as
w1=0,-1 will not satisfy equation (4).
Hence. w1=1,w2=1,w3=-1
c) XOR
x1 | x2 | y |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Boolean Representation of XOR -
x1x2'+x1'x2 (x1' represents x1 complement)
Simplification -
x1'x2 +
x1x2' + x1'x1 + x2'x2
x1(x1' +
x2') + x2(x1' + x2')
(x1 +
x2)(x1' + x2')
(x1 +
x2)(x1x2)'
It is a combination of 1 OR, 2 AND and 1 NOT function.
Neural Networks We will now build some neural networks to represent basic boolean functions. For simplicity, we use the threshold function as our basic units instead of the sigmoid function, where th...