<<

Appendix A A Non-linear : An Introduction to

A.1 Basic Logical Gates

This chapter is, strictly speaking, not about . Nonetheless, the topic of this chapter, i.e. Boolean algebra, is related to linear algebra and it has been crucially important, over the last decades, for the progress of . More specifically, while linear algebra deals with , vectors, and matrices, Boolean algebra deals with binary states 0 and 1. In , the basic operators of Boolean algebra are non-linear. Furthermore, it must be remarked that Boolean algebra is related to linear algebra as it allows its implementation within digital circuits. Thus, Boolean algebra can be seen as the “trait d’” between and computational science. In order to introduce Boolean algebra, let us consider an object x and a A.A membership mf (x) scores 0 if x ∈/ A and1ifx ∈ A. At an abstract level, if we consider all the possible objects and sets of the universe, we can associate a membership relationship between each object and set. Each relationship will score 0 when the belonging relationship is not verified (the statement is ) and 1 when the belonging relationship is verified (the statement is true). We can think about an space where only the true and false (or 1 and 0, respectively) are allowed. In this space, the variables, namely binary variables can be combined to generate a binary algebra, namely Boolean algebra. Since the latter has to obey to logical rules, the same subject can be seen from a different perspective and named Boolean . This name is due to , the English mathematician that in 1853 described this logic in his book, “An Investigation of ”, see [30]. As mentioned above, in Boolean algebra, a x can take either the value 0 or 1. Thus, x is a generic variable of a binary set B = {0, 1}. Three elementary operators (or basic logical gates), one of them unary (that is applied to only one variable) and two of them binary (that is applied to two variables) are here introduced. The first operator, namely NOT, is defined in the following way:

© Springer International Publishing Switzerland 2016 451 F. Neri, Linear Algebra for Computational Sciences and Engineering, DOI 10.1007/978-3-319-40341-0 452 Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra

if x = 1 then x¯ = NOT (x) = 0 if x = 0 then x¯ = NOT (x) = 1

The NOT operators is also graphically represented by the following .

The second operator, namely AND or logical , processes two inputs, x and y respectively, and returns the values x ∧ y according to the following rules:

x y x ∧ y 0 0 0 1 0 0 0 1 0 1 1 1

A graphical representation of the AND operator is given in the following way.

The third operator, namely OR or logical sum, processes two inputs, x and y respectively, and returns the values x ∨ y according to the following rules:

x y x ∨ y 0 0 0 1 0 1 0 1 1 1 1 1

A graphical representation of the OR operator is given in the following way.

A.2 Properties of Boolean Algebra

As for numerical linear algebra, the Boolean operators are characterized by basic properties. These properties are here listed. Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra 453

• neutral for AND: ∀x binary , x ∧ 1 = x • for AND: ∀x , x ∧ 0 = 0 • neutral element for OR: ∀x binary number, x ∨ 0 = x • absorbing element for OR: ∀x binary number, x ∨ 1 = 1 • commutativity with respect to AND: x ∧ y = y ∧ x • commutativity with respect to OR: x ∨ y = y ∨ x • distributivity 1: x ∧ (y ∨ z) = (x ∧ y) ∨ (x ∧ z) • distributivity 2: x ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z) • property 1: x ∧ x = x • identity property 2: x ∨ x = x • negative property 1: x ∧¯x = 0 • negative property 2: x ∨¯x = 1

These basic properties, when combined, allow us to detect more complex rela- tionships, as shown in the following example.

Theorem A.1 x ∧ (x ∨ y) = x

Proof x ∧ (x ∨ y) = (x ∧ x) ∨ (x ∧ y) = x ∨ (x ∧ y) = x ∧ (1 + y) = x ∧ 1 = x. 

Important properties of Boolean algebra are the so-called De Morgan’s laws.

Theorem A.2 (First De Morgan’s Law) The of a disjunction is the con- junction of the . (x ∨ y) =¯x ∧¯y

Proof In order to prove the first De Morgan’s law, we consider that (x ∨ y) =¯x ∧¯y is equivalent to write that (x ∨ y) ∧ (x¯ ∧¯y) = 0 (for the negative property 1). The latter equation can be written as (x ∨ y) ∧ (x¯ ∧¯y) = ((x ∨ y) ∧¯x) ∧¯y = (0 ∨ (x¯ ∧ y)) ∧¯y =¯x ∧ y ∧¯y =¯x ∧ 0 = 0 

Theorem A.3 (Second De Morgan’s Law) The negation of a conjunction is the disjunction of the negations. (x ∧ y) =¯x ∨¯y

The second De Morgan’s Law can be proved in an analogous way.

Example A.1 Let us consider the following expression (x ∨ y)∧(x ∨¯y). This expres- sion can be simplified. Let us re-write it:

(x ∨ y) ∧ (x ∨¯y) = x ∨ x ∧¯y ∨ x ∧ y ∨ 0 = = x ∧ (1 ∨ y ∨¯y) = x ∧ (1 ∨ y) = x. 454 Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra

A.3 Boolean Algebra in Algebraic Structures

The abstract aspects of Boolean Algebra are very complex and deserves possibly a separate book. However, with the purpose of linking Boolean Algebra to the other chapters of this book, especially to place it within algebraic structures, this section introduces some other concepts of abstract algebra.

Definition A.1 The composed of a set L endowed with two binary operators ∨ and ∧, respectively, is said lattice and indicated with (L, ∨, ∧).For lattices and x, y, z ∈ L, the following properties hold: • commutativity 1: x ∨ y = y ∨ x • commutativity 2: x ∧ y = y ∧ x • associativity 1: (x ∨ y) ∨ z = x ∨ (y ∨ z) • associativity 2: (x ∧ y) ∧ z = x ∧ (y ∧ z) • absorption 1: x ∨ (x ∧ y) • absorption 2: x ∧ (x ∨ y) • 1: a ∨ a = a • idempotence 2: a ∧ a = a

Definition A.2 A lattice (L, ∨, land) is said to be bounded when 0 is the neutral element for ∨ (x ∨ 0 = x) and 1 is the neutral element for ∧ (x ∧ 1 = x).

It can be observed that a lattice can be seen as the combination of two : (L, ∨) and (L, ∧) respectively. In the cases of bounded lattice, it is the combination of two .

Definition A.3 A lattice (L, ∨, land) is said to be complemented when it is bounded (with infimum equal to 0 and supremum equal to 1) and for all x ∈ L, there exists an element y such that x ∧ y = 0 and x ∨ y = 1.

Definition A.4 A lattice (L, ∨, ∧) is said to be distributive when the following equality holds x ∧ (y ∨ z) = (x ∧ y) ∨ (x ∧ z) .

The latter equality can be proved to be equivalent to

x ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z) .

It can be easily seen that Boolean algebra is a complemented . Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra 455

A.4 Composed Boolean Gates

From the three basic gates several composed gates can be generated. An important example is the NAND operator composed of an AND and a NOT and here represented.

A more complex example is the XOR operator. This operator processes two inputs and returns 0 when the inputs are the same and 1 when they are different.

x y x ∨ y 0 0 0 1 0 1 0 1 1 1 1 0

This operator is composed as x ∧¯y ∨¯x ∧ y. This expression is graphically repre- sented in the following way,

or, more compactly as

In order to appreciate the practical implications of Boolean logic and it composed gates, let us consider a so-called half circuit. The latter is a logic structure, obtained by a straightforward combination of XOR and AND gates, that performs sum. The scheme is given by: 456 Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra

If we consider that S stands for sum while stands for carry, the functioning of the half adder can be summarized in the following way. A more complex example is the XOR operator. This operator processes two inputs and returns 0 when the inputs are the same and 1 when they are different.

x y C S 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0

As shown the result of the 1 + 1 = 10 (where 10 is 2 in binary). Thus, the half adder is an elementary structure that can be used to perform sums. More generally, Boolean logic allows, by means of binary operator, to define a complex logic. This feature is relevant in computational devices where the physics imposes the employment of a binary logic at the hardware level. Without entering into the details of a hardware, it can be easily seen that it is easier to measure whether or not an amperage flows trough a conductor rather than measuring it intensity and associate a semantic value to it. In other words, in order to be reliable a must be kept simple at the low level. Then these simple gates can be logically combined in billions of way in order to build a complex logic. As a further remark, Boolean logic was not defined to satisfy the necessities of a computational device since it was defined about one century earlier that the first . This statement is to highlight that research in mathematics normally precedes applied research of years if not centuries.

A.5 Crisp and Fuzzy Sets

As stated above, Boolean logic is derived from the concept that an object x either belongs or does not belong to a set A. The idea of membership of an object to a set is formulated as a membership function mF that can take only two values, i.e. 0 and 1. In this case, the set A is said to be crisp. Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra 457

However, an object x can belong to a set A with a certain degree of membership. For example if person is considered “quite tall”, he/she is not fully a member of the set of tall people. More mathematically this person is said to belong to the set of tall people with a certain degree or, this person is associated to a membership function value between 0 and 1. In general we can associate to each set A a continuous membership function mF that makes correspond to each object x its degree of membership to the set. For example, we can say that with respect to the set A, mF = 0.8. In this case, the set A is said to be a ,see[31].

A.6 Exercises

A.1 Proof of the equivalence Select the expression equivalent to x ∧ y ∨ x ∧ y ∧ z (a) x ∧ y (b) y¯ (c) x ∧ z (d) x ∧ y ∧ z

A.2 Determine the values of x, y, z, v such that x¯ ∨ y ∨¯z ∨ v = 0

A.3 Derive the Boolean expression from the following logical circuit

(a) x ∨ y ∧ z ∨ v (b) z (x ∨ y) ∨ v (c) (z ∨ v) ∧ (x ∨ y) (d) (x ∧ y) ∨ z ∨ v

A.4 Considering the result of the Boolean expression ( table) 458 Appendix A: A Non-linear Algebra: An Introduction to Boolean Algebra

x y z Out 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 extract the corresponding Boolean expression. (a) x ∧ y ∧ z ∨ x ∧ y ∧ z ∨ x ∧ y ∧ z (b) x ∧ y ∧ z ∨ x ∧ y ∧ z ∨¯x ∧ y ∧¯z (c) x¯ ∧¯y ∧ z ∨¯x ∧ y ∧ z ∨ x ∧ y ∧¯z (d) x ∧¯y ∧¯z ∨¯x ∧ y ∧¯z ∨ x ∧¯y ∧ z Appendix B Proofs of that Require Further Knowledge of Mathematics

Theorem B.1 (Rouchè-Capelli Theorem (Kronecker-Capelli Theorem)) Asystem of m linear equations in n variables Ax = b is compatible if and only if both the incomplete and complete matrices (A and Ac respectively) are characterised by the same rank ρA = ρAc = ρ named rank of the system.

Proof The system of linear equations Ax = b can be interpreted as a linear mapping f : Rn → Rm f (x) = Ax.

This system is determined if one solution exists, i.e. if ∃x0 such that f (x) = b. This means that the system is determined if b ∈ Im (f ). The basis spanning the image (Im (f ) , +, ·) is composed of the column vectors of the matrix A: ={ , ,..., } BIm(f ) I1 I2  In A = I1 I2 ... In .

Thus, the fact that b ∈ Im (f ) is equivalent to the fact that b belongs to the span of the column vectors of the matrix A:

b = L (I1, I2,...,In) .

This is equivalent to say that the rank of   A = I1 I2 ... In and   c A = I1 I2 ... In b have the same rank. Thus, the system is compatible if ρA = ρAc = ρ. 

© Springer International Publishing Switzerland 2016 459 F. Neri, Linear Algebra for Computational Sciences and Engineering, DOI 10.1007/978-3-319-40341-0 460 Appendix B: Proofs of Theorems that Require Further …

Theorem B.2 (Euler’s Formula) For every x ∈ R,

ejθ = cos θ + j sin θ, where e is the Euler’s number 2.71828, base of natural logarithm.

Proof Let us consider a complex number z = a+jb on the unitary circle of the com- plex plane. The number can be re-written, taking into account the polar coordinated, as z = ρ (cosθ + jsinθ) . where ρ = 1. Hence, z = cosθ + jsinθ.

Let us compute the derivative of z with respect to θ:

dz =−sinθ + jcosθ = j (cosθ + jsinθ) = jz. dθ This means that the derivative operator is equivalent to the multiplication by the imaginary unit. Let us rearrange the equation as

dz = jdθ. z

If we integrate this we obtain:   dz = jdθ ⇒ ln (z) = jθ ⇒ z = ejθ . z

Considering that z = cosθ + jsinθ we obtain

θ ej = cosθ + jsinθ.   ( ) = n k Theorem B.3 (Fundamental Theorem of Algebra) If p z k=0 akz is a complex polynomial having order n ≥ 1, then this polynomial has at least one root.

Proof Let us assume, by , that a complex polynomial p (z) with no roots exists. More specifically, let p (z) be a complex polynomial such that p (z) = 0 ∀z, i.e. p (z) is a polynomial that has no roots. The function 1 f (z) = . p (z) is defined since it always occurs that p (z) = 0. Appendix B: Proofs of Theorems that Require Further … 461

Then, let us calculate

lim | p (z) |= +∞. |z|→+∞

Thus, 1 lim | |= 0. |z|→+∞ p (z)

This means that the function f (z) is limited. For the Liouville’s Theorem, see [32, 33], the function f (z) is constant. Hence, also p (z) is constant. In other words, the only polynomials that have no roots are the constant polynomials. If the order of the polynomial is at least one there will be roots. 

Theorem B.4 If the vectors a1, a2,...,an are linearly independent the Gram deter- minant G (a1, a2,...,an) > 0.

Proof If the vectors are linearly independent, let us assume that x = λ1a1 + λ2a2 + ...+ λnan with λ1,λ2,...,λn ∈ R. We can thus write that

n n 2 2 x = (λ1a1 + λ2a2 + ...+ λnan) = λiλjaiaj. i=1 j=1

This polynomial is a quadratic form,see[34], whose discriminant is equal to the Gram determinant. It can be verified that this quadratic form is positive definite. Hence, G (a1, a2,...,an) > 0. References

1. J. Hefferon, Linear Algebra (Saint Michael’s College, 2012) 2. G. Cramer, Introduction a L’analyse des Lignes Courbes Algebriques (Europeana, Geneva, 1750), pp. 656–659 3. K. Hoffman, R. Kunze, Linear Algebra (Prentice-Hall, Englewood Cliffs, 1971) 4. A. Schönhage, A. Grotefeld, E. Vetter, Fast . A Multitape Imple- mentation (1994) 5. J.B. Fraleigh, R.A. Beauregard, Linear Algebra (Addison-Wesley Publishing Company, 1987) 6. J. Grcar, Mathematicians of gaussian elimination. Notices Am. Math. Soc. 58(6), 782–792 (2011) 7. N. Higham, Accuracy and Stability of Numerical Algorithms (SIAM, 2002) 8. D.M. Young, Iterative methods for solving partial difference equations of elliptical type. Ph.D. thesis. Harvard University (1950) 9. H. Coxeter, Introduction to (Wiley, 1961) 10. T. Blyth, E. Robertson, Basic Linear Algebra. Springer Undergraduate Mathematics Series (Springer, 2002) 11. D.M. Burton, The (McGraw-Hill, 1995) 12. M.A. Moskowitz, A Course in in One Variable (World Scientific Publishing Co, 2002) 13. M.R. Spiegel, Mathematical Handbook of Formulas and Tables (Schaum, 1968) 14. A. Kaw, E. Kalu, Numerical Methods with Applications (2008) 15. J.P. Ballantine, A.R. Jerbert, Distance from a line, or plane, to a point. Am. Math. Monthly 59(4), 242–243 (1952) 16. D. Riddle, (Wadsworth Pub. Co., 1982) 17. H.S.M. Coxeter, Projective Geometry (Springer, 2003) 18. K.G. Binmore, : A Straightforward Approach, 2nd edn. (Cambridge University Press, New York, 1982) 19. D.V. Widder, The Laplace Transform (1941) 20. R. Larson, D.C. Falvo, Elementary Linear Algebra (Houghton Mifflin, 2008) 21. A. Cobham, The intrinsic computational difficulty of functions, in Proceedings of the Logic, Methodology, and Philosophy of Science II, North Holland, 1965 22. D. Kozen, Theory of (Birkhäuser, 2006) 23. S. Arora, B. Barak, Computational Complexity: A Modern Approach, 1st edn. (Cambridge University Press, New York, 2009) 24. D. Huffman, A method for the construction of minimum-redundancy codes. Proc. IRE 40, 1098–1101 (1952) © Springer International Publishing Switzerland 2016 463 F. Neri, Linear Algebra for Computational Sciences and Engineering, DOI 10.1007/978-3-319-40341-0 464 References

25. J. Łukasiewicz, ’s Syllogistic from the Standpoint of Modern Formal Logic (Oxford University Press, 1957) 26. L. Euler, Solutio problematis ad geometriam situs pertinensis, in Commentarii Academiae Scientiarum Imperialis Petropolitanae, vol. 8 (1736) 27. K. Appel, W. Haken, Solution of the four color problem. Sci. Am. 237(4), 108–121 (1977) 28. K. Mei-Ko, Graphic programming using odd or even points. Chinese Math. 1, 273–277 (1962) 29. C.A. Desoer, E.S. Kuh, Basic Circuit Theory (McGraw-Hill Education, 2009) 30. G. Boole, An Investigation of the Laws of Thought (Prometheus Books, 1853) 31. L.A. Zadeh, Fuzzy sets. Inf. Control 8(3), 338–353 (1965) 32. J. Liouville, Lecons sur les fonctions doublement periodiques. J. die Reine und Angew. Math. 88, 277–310 (1879) 33. V. Vladimirov, Methods of the Theory of Functions of Several Complex Variables (1966) 34. O.T. O’Meara, Introduction to Quadratic Forms (Springer, 2000)