15
ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function We seek a way of undoing what a function does, so that we get back to the original input x. That is, given a value for y = f (x), we seek to know what the value for x is. We are trying to go back from y to x. This is called finding the inverse of a function, reversing the black box that we put x into to get y = f (x). For a function f (x) then, we seek an inverse function g(y), such that x = g(y), that is, such that composing g with f gets back to x, that is g(f (x)) = x. We usually label the inverse function of f as f -1 (x) . The order of composition of a function and its inverse do not matter, so that f -1 (f (x)) = f (f -1 (x)) = x. [Can you prove this, using only the definition f -1 (f (x)) = x, and the properties of functions?] Example: If f (x)=3x, then verify that f -1 (x)= x/3. Solution: f (x)=3x, so f -1 (f (x)) = f -1 (3x), and we want this to give x. Hence we define y =3x to get f -1 (y)= x = y/3. Hence the function f -1 must be given by f -1 (y)= y/3, that is, since the name of the input does not matter here, f -1 (x)= x/3. Note that a function must be one-to-one if it is to have an inverse function. That is, if a function is to be invertible, it must pass the horizontal line test. Example: f (x)=3x + 1 has inverse f -1 (x)=(x - 1)/3. The function g(x)=(x - 1)/3 has inverse g -1 (x)=3x + 1. This illustrates that if f has inverse g, then the inverse of g is f . Example: The function f = x 2 , “square the input”, gives the same result if you square the negative of the input. Hence, given say that x 2 = 4, we are not sure what the value 16

5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

ENGR121 Engineering Mathematics Lecture Notes

SMS, Victoria University of Wellington

Week Two.

5.5 The Inverse of a Function

We seek a way of undoing what a function does, so that we get back to the original inputx. That is, given a value for y = f(x), we seek to know what the value for x is. We aretrying to go back from y to x. This is called finding the inverse of a function, reversingthe black box that we put x into to get y = f(x).

For a function f(x) then, we seek an inverse function g(y), such that x = g(y), that is,such that composing g with f gets back to x, that is

g(f(x)) = x .

We usually label the inverse function of f as

f−1(x) .

The order of composition of a function and its inverse do not matter, so that

f−1(f(x)) = f(f−1(x)) = x .

[Can you prove this, using only the definition f−1(f(x)) = x, and the properties offunctions?]

Example: If f(x) = 3x, then verify that f−1(x) = x/3.

Solution:f(x) = 3x, so f−1(f(x)) = f−1(3x), and we want this to give x. Hence we define y = 3xto get f−1(y) = x = y/3. Hence the function f−1 must be given by f−1(y) = y/3, thatis, since the name of the input does not matter here, f−1(x) = x/3.

Note that a function must be one-to-one if it is to have an inverse function. That is, if afunction is to be invertible, it must pass the horizontal line test.

Example: f(x) = 3x+ 1 has inverse f−1(x) = (x− 1)/3. The function g(x) = (x− 1)/3has inverse g−1(x) = 3x+ 1. This illustrates that if f has inverse g, then the inverse of gis f .

Example: The function f = x2, “square the input”, gives the same result if you squarethe negative of the input. Hence, given say that x2 = 4, we are not sure what the value

16

Page 2: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

of x was that gave us 4. It could have been 2, or −2. The function has an inverse rule“take plus or minus the square root of the input”, which is a one-to-many relation, andhence is not a function. f = x2 is noninvertible. It fails the horizontal line test, so is notone-to-one.

We can fix this by restricting the domain of the function f = x2 to R+. Then f−1 =√x.

Note that we will DEFINE the square root function to be always a positive or zero number.When the domain of f = x2 is restricted to R+, it passes the horizontal line test and isone-to-one.

Warning: be careful to understand that an inverse function f−1(x) is different to thereciprocal of the function f(x), which is in fact the multiplicative inverse 1/f(x). Mul-tiplying a function by its reciprocal gives the answer 1. Composing a function with itsinverse function gives the identity function, so that f−1(f(x)) = x, not 1.

Just to further challenge your mathematical reading ability, you could alternatively writethe reciprocal of the function f(x) as (f(x))−1. This is a very different function to theinverse function of f(x), which is f−1(x).

5.6 Continuous and Piecewise Continuous Functions

This is a relatively informal treatment of continuity of functions. If you can draw afunction without lifting your pen, it is a continuous function.

If you can draw a function in a finite number of pieces that are continuous, it is calleda piecewise continuous function wherever it is defined. The places where it is broken arecalled discontinuities.

Example: f(x) = 1/x has an infinite discontinuity at x = 0, where the function isundefined. Since it is not defined at x = 0, it is not piecewise continuous across x = 0.You can’t draw it at x = 0. It is continuous on the domain R+, and on the domain R−.It is graphed in the left-hand plot in figure (5).

Example:

g(x) =

{2 , 0 ≤ x < 1x , 1 ≤ x ≤ 3

This function is piecewise continuous on [0, 3]. It is not defined outside this domain. Ithas a step discontinuity at x = 1. It is graphed in the middle plot in figure (5).

Example:

h(x) =

{x , 0 ≤ x < 12x− 1 , 1 ≤ x < 2

17

Page 3: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

This function is continuous on (0, 2). It is piecewise defined, but has no discontinuity atx = 1. It is graphed in the right-hand plot in figure (5).

Figure 5: Graphs of an infinite discontinuity at origin (f = 1/x); a piecewise continuousfunction g(x); and a piecewise defined but continuous function h(x).

5.7 Periodic Functions

A periodic function repeats itself indefinitely. We define f to be periodic with period T ,if

f(t) = f(t+ T ) .

Examples are the sawtooth, and square waves, illustrated in figure (6). They are piece-wise continuous. The vertical lines are optional in engineering although in a strictermathematical approach they would be absent.

A formula for the sawtooth is

f(x) = x− bxc

where bxc is the floor function of x, the largest integer that is not greater than x.

A formula for the square wave is

f(x) =

{1 , x− bxc < 0.5−1 , else

18

Page 4: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Figure 6: Graphs of periodic functions — a sawtooth and a square wave.

19

Page 5: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

6 Logic

(Croft, section 5.3)We will introduce the ideas of logic by using logic gates, the building blocks for digitallogic circuits. The inputs to each gate can be either a high or a low voltage, which werepresent as 1 or 0. The single result of a particular combination is the output of the gate,and is either a high voltage (1) or a low voltage (0). The truth table is a summary ofthe possible inputs and the resulting outputs. In logic, 1 is also associated with “true”,and 0 with “false”.

6.1 The OR gate

The OR gate has two inputs we will call A and B. It produces a 1 whenever A or B is 1,hence the name OR. The graphical symbol or circuit symbol for the OR gate, with two

inputs on the left and one output on the right, is and the truth table is

Table 1: The truth table for the OR gate, with inputs A and B.

A B F = A+B

1 1 11 0 10 1 10 0 0

The mathematical symbol for the OR gate is +, as in the truth table. OR is a logicalconnective, and it is also called a disjunction.

6.2 The AND gate

The AND gate has two inputs we will call A and B. It produces a 1 only when both Aand B are 1, hence the name AND. The graphical symbol or circuit symbol for the AND

gate, with two inputs on the left and one output on the right, is and the truth

table is

20

Page 6: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Table 2: The truth table for the AND gate, with inputs A and B.

A B F = A ·B = AB

1 1 11 0 00 1 00 0 0

The mathematical symbol for the AND gate is ·, or just an implied product, as in thetruth table. AND is a logical connective, also known as a conjunction.

6.3 The NOT gate

The NOT gate is also called an inverter. It takes only one input A, and produces one

output A, also known as the complement of A. The graphical symbol is and

the truth table is

Table 3: The truth table for the NOT gate, with input A and output F = A.

A F = A

1 00 1

6.4 The NOR gate

This gate combines the OR and the NOT gates in series. The combination of symbols is

usually shortened to the graphical symbol for the NOR gate, and the truth

table is

21

Page 7: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Table 4: The truth table for the NOR gate, with inputs A and B.

A B F = A+B

1 1 01 0 00 1 00 0 1

6.5 The NAND gate

This gate combines the AND and the NOT gates in series. The combination of symbols is

usually shortened to the graphical symbol for the NAND gate, and the truth

table is

Table 5: The truth table for the NAND gate, with inputs A and B.

A B F = A ·B

1 1 01 0 10 1 10 0 1

7 Boolean Algebra

(Croft, section 5.4)A Boolean Algebra consists of binary variables (say A and B) which can take the binaryvalues 0 or 1, together with the logical connectives + and · and the complement NOT.We may call such A and B boolean variables. Expressions like A + B and A · B arecalled boolean expressions, and can be built up into more complicated expressions.Boolean expressions can have a truth table drawn up for them, to show the resultingvalue obtained (which will be 0 or 1). There are a number of laws that apply to booleanalgebras, shown in Tables (6) and (7), and you will see that they are analogous to thelaws of set algebra, with + interpreted as ∪, · as ∩, 1 as the universal set E, and 0 as theempty set φ.

22

Page 8: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

It is a convention called the rule of precedence that, as in ordinary algebra, · takesprecedence over +. For example, A+(A ·C) can be written without the brackets, withoutambiguity, as A + A · C . However, the brackets in (A + B) · C are important, and(A+B) · C = A · C +B · C = (A · C) + (B · C).

Table 6: The laws of Boolean Algebra.

A+B = B + A Commutative lawsA ·B = B · A

A+ (B + C) = (A+B) + C Associative lawsA · (B · C) = (A ·B) · C

A · (B + C) = (A ·B) + (A · C) Distributive lawsA+ (B · C) = (A+B) · (A+ C)

A+ 0 = A Identity lawsA · 1 = A

A+ A = 1 Complement lawsA · A = 0

A = A

Table 7: The laws of Boolean Algebra that may be derived from Table (6).

A+ (A ·B) = A Absorption lawsA · (A+B) = A

(A ·B) + (A ·B) = A Minimisation laws(A+B) · (A+B) = A

A+B = A ·B De Morgan’s lawsA ·B = A+B

A+ 1 = 1A · 0 = 0

Example: Construct the truth table for A+B · C.

Solution: There are clearly three inputs, A, B, C. Each of these boolean variables cantake the values 0 or 1, and we need to cover all of the eight possible combinations, whichare shown in Table (8).

We start with this table, and in each row we first compute C, then AND it with B tofind B · C. Then we OR the result with A, to find A + B · C. Note that the key to allthis is to break down the boolean expression into sub-expressions that we already know

23

Page 9: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Table 8: The eight possible combinations of boolean variables A, B, and C.

A B C

1 1 11 1 01 0 11 0 00 1 10 1 00 0 10 0 0

how to compute. It may be easier to do this column by column. The result is presentedin Table (9).

Table 9: The truth table for A+B · C

A B C C B · C A+B · C

1 1 1 0 0 11 1 0 1 1 11 0 1 0 0 11 0 0 1 0 10 1 1 0 0 00 1 0 1 1 10 0 1 0 0 00 0 0 1 0 0

7.1 Logical Equivalence

The distributive laws of boolean algebra tell us that A+(B ·C) = (A+B) ·(A+C), whichmay look a bit unexpected when compared with ordinary algebra rules. We have alreadyconstructed the truth table for the left-hand side of this equation. We now construct thetruth table for the right-hand side of this law, see Table (10).

Note that the last column in Table (10) matches exactly the last column in Table (9).This means that the left-hand side of A + (B · C) = (A + B) · (A + C) produces exactlythe same digital output as the right-hand side. When the truth tables results columnsmatch in this way, we say that the boolean expressions being compared are logicallyequivalent to each other.

24

Page 10: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Table 10: The truth table for (A+B) · (A+ C)

A B C C A+B A+ C (A+B) · (A+ C)

1 1 1 0 1 1 11 1 0 1 1 1 11 0 1 0 1 1 11 0 0 1 1 1 10 1 1 0 1 0 00 1 0 1 1 1 10 0 1 0 0 0 00 0 0 1 0 1 0

This confirms or proves that the stated distributive law is true.

One use of such logically equivalent boolean expressions, is that they each correspondto a logical circuit constructed of OR gates, AND gates and inverters. So two differentelectronic circuits produce the same results, if they are logically equivalent. This is usefulfor simplifying circuits to reduce the number of components required — as may be seenin Fig. (7), the left-hand side A+ (B ·C) requires fewer gates than the right-hand circuit(A+B) · (A+ C).

Figure 7: Two equivalent circuits. The upper one implements A+ (B ·C), and the lowerone implements (A+B) · (A+ C).

Given a logical circuit like one of those pictured in Fig. (7), you should now be able toconstruct a truth table.

Example:

25

Page 11: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Find the boolean expression and truth table for the electronic circuit shown in Fig. (8).

Figure 8: Find the boolean expression and construct the truth table for this logic circuit.

We look at the last gate, which is an OR gate so it has result X = F +G where F is theoutput of the upper left gate, and G is the output of the lower left gate. But F = A · Bsince the upper left gate is an AND gate. And G = C since the lower left gate is aNOT gate. Putting these together we find that the circuit corresponds to the booleanexpression X = F +G = A ·B + C, that is,

X = F +G = A ·B + C .

Another way to construct this expression would be to start from the left, getting A · Band C from the first column of gates, then OR them finally to get the same result.

The truth table 11 is constructed in the usual way from the boolean expression, byconsidering all possible combinations of values for the inputs A, B, and C.

Table 11: The truth table for Fig. (8).

A B C A ·B C A ·B + C

1 1 1 1 0 11 1 0 1 1 11 0 1 0 0 01 0 0 0 1 10 1 1 0 0 00 1 0 0 1 10 0 1 0 0 00 0 0 0 1 1

26

Page 12: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

7.1.1 Finding the circuit

Here is an illustration of the procedure for reversing this: given a truth table, find aboolean expression that produces it, hence finding an electronic circuit that producesit.

Example:Given inputs A, B, and C, find a boolean expression that produces the truth table inTable (12).

Table 12: The truth table for an unknown boolean expression with inputs A, B, and C,and with output X.

A B C X

1 1 1 11 1 0 11 0 1 01 0 0 10 1 1 00 1 0 10 0 1 00 0 0 1

SolutionWe focus on the rows which give the result 1. These rows are rows 1, 2, 4, 6 and 8. Thereare five of them.

We look at the first such row, and we see that A, B, and C are all 1 in value. So a way toget the result 1 is to construct the AND sequence A · B · C. This has the desired result,plus it gives 0 for any other combination of values of A, B, and C. That is, you get 1 ifand only if A AND B AND C are 1.

This AND construction for the next value one row, row number 2, gives A ·B · C, whichonly takes the value 1 when A = 1, B = 1, and C = 0.

If we were to now take the OR combination (the disjunction) X = A · B · C + A · B · C,we would have a logic circuit that gives the first two rows with result 1, and gives zerofor all other input values. We are partly there.

We continue to deal only with the rows giving one in value: row 4 needs the combinationA · B · C; row 6 needs A · B · C; and row 8 needs A · B · C. The final step is to combineall five “one rows” using the disjunction of five terms

X = A ·B · C + A ·B · C + A ·B · C + A ·B · C + A ·B · C .

27

Page 13: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

This by construction will give the desired value of 1 in rows 1,2,4,6,8. It will be zeroeverywhere else.

You can construct the truth table for the above expression and find that it matchesTable (12). It is not the simplest boolean expression giving the desired truth table.

Note that there will always be the same number of terms in the disjunction, as there arerows with output value 1 (five in the present case).

This method for finding a boolean expression, by picking the rows giving one as a result,by ANDing the inputs to get the value one just for that combination in that row, andthen by ORing together each of these row expressions, produces what is known as thedisjunctive normal form or d.n.f.

We need a method for simplifying the resulting d.n.f., to reduce the number of gatesrequired to construct the circuit. This is done by using the laws of boolean algebra. Firstwe introduce another useful gate.

7.2 The exclusive OR gate

The OR gate we already know about actually has the full name the inclusive OR gate.It gives 1 whenever one or both of the inputs are 1. A gate that only gives a 1 if eitherbut not both of the inputs are 1, is the exclusive OR gate. Its truth table is given inTable (13). You should be able to derive using the table that the d.n.f. is

F = A ·B + A ·B .

This gate can appear in the most fundamental units of a digital logic circuit. It has the

circuit symbol

Table 13: The truth table for the exclusive OR gate, with inputs A and B.

A B F

1 1 01 0 10 1 10 0 0

28

Page 14: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

Example:In this example, we begin to see how to simply disjunctions:

Use the laws given in Table (6) to simplify the following expressions.

1. A ·B + A ·B

2. A+ A ·B

3. A+ A ·B · C

4. A ·B · C + A ·B · C + A ·B · C + A ·B · C + A ·B · C

Solutions:

1. The distributive law says that

A ·B + A ·B = A · (B +B)

then using the complement law B +B = 1 so that using the identity law,

A ·B + A ·B = A · 1 = A .

Note that we have just proved the first minimisation law in Table (7).

2. By the distributive law,

A+ A ·B = (A+ A) · (A+B)

then by the complement law,

(A+ A) · (A+B) = 1 · (A+B)

to finally give, by the identity law,

A+ A ·B = A+B .

3. We first make a clearer association by using brackets

A+ A ·B · C = A+ (A ·B) · C

then the distributive law gives

A+ (A ·B) · C = (A+ A ·B) · (A+ C)

and part 2 above gives

(A+ A ·B) · (A+ C) = (A+B) · (A+ C)

then the distributive law gives

A+ A ·B · C = A+B · C .

29

Page 15: 5.5 The Inverse of a Function - Victoria University of …...ENGR121 Engineering Mathematics Lecture Notes SMS, Victoria University of Wellington Week Two. 5.5 The Inverse of a Function

4. This is a typical d.n.f. from a truth table. We first rearrange it using the commu-tative laws to give

A·B·C+A·B·C+A·B·C+A·B·C+A·B·C = A·B·C+A·B·C+A·B·C+A·B·C+A·B·C

which becomes

A ·B · (C + C) + A ·B · (C + C) + A ·B · C by the distributive law

= A ·B · 1 + A ·B · 1 + A ·B · C by the complement law

= A ·B + A ·B + A ·B · C by the identity law

= A · (B +B) + A ·B · C by the distribution law

= A+ A ·B · C by the complement and identity laws

and then using the result of part 3, this simplifies to

A+B · C

30