In this video, we explore ways in which we can build more complicated functions from simple functions. The key idea is composition. And the process is analogous, for example, to cooking, in putting simple ingredients together to make a cake or a meal. or in chemistry, to building more and more complicated molecules from simple or primitive atoms. Let me introduce two friends fog and gof, both of which turn out to be composite functions. Who are they? Well, to get started, let f and g be functions with rules y equals f of x and y equals g of x. To define the composite function f circle g, also called fog, and sometimes written with brackets around all of f circle g by the rule y equals f of g of x. By which we mean, apply f to the result of applying g, note that g is applied to the input x first, only then is the rule for f applied and not to x but to g of x. The small o symbol in between the functions f and g is called the circle operation. Order is very important. Remember that functions are processes, and you don't expect the same outcome if you change the order in which you perform them. If I put a sock on my foot and then a shoe on over the sock, the outcome is completely different if I do these processes in the other order. We introduced fog or f circle g. What happens if we reverse the order? To find the composite function g circle f, also called gof, again, sometimes written with brackets around all of g circle f by the rule y equals g of f of x, by which we mean apply g to the result of applying f. See the difference? Now, f is applied to the input x first, only then is the rule for g applied and not to x but to f of x. Let's look at some examples. Consider the functions f, g, and h given by these rules. We'll find rules for f circle g, fog, g circle f, gof, f circle h and h circle f. Beginning with f circle g, fog of x equals f of g of x, which is f of x squared since g of x is x squared. Then, applying the rule for f to the new input x squared, we get 2x squared minus 3. Now, in the other order, gof of x equals g of f of x, which is g of 2x minus 3 applying the rule f to x. Then, applying the rule for g to this new input 2x minus 3, we get 2x minus 3 all squared, and we can expand this to 4x squared minus 12x plus 9 if we like. You can see that the rules are very different. So, fog and gof are very different functions. The last two examples we'll look at, f circle h and h circle f, turn out to be very special. We have f circle h of x equals f of h of x, which is f of x plus 3 on two applying the rule of h to x, which in turn is 2 times x plus three on 2 minus 3, applying the rule for f to the new input x plus 3 on 2, which simplifies in a couple of steps to x. Notice that the net effect of the composite function is to take the input x to itself. On the other hand, h circle f of x equals h of f of x, which is h of 2x minus 3, applying the rule of f to x, which in turn is 2x minus 3 plus 3 all over 2, applying the rule for h to the new input 2x minus 3. Which also simplifies in a couple of steps to x. In both cases, the composite function is the lazy function that simply outputs the input. This is also known as the identity function. Thus, f and h have the property of undoing each other, and the composites in either order turn out in fact to be the same namely the identity or lazy function. It's very rare for composites taken in different order to be the same, so we're lucky in this case. We stumbled on a particular phenomenon where the functions happened to be inverses of each other. Inverse functions are very important and will be the topic of discussion in the next video. The circle operation creates some kind of arithmetic involving functions regarded as objects in their own right. You're used to doing arithmetic with numbers, but you can also do weird arithmetics with functions, and the circle operation is one of the main tools. These arithmetics are very useful and have all sorts of applications, but they're so exotic and strange, and in fact, we know very little about them. If you pursue higher mathematics, they take you right up to the forefront of modern research in mathematics. Maybe some of you saw the movie "The Imitation Game" about the mathematician Alan Turing breaking codes during the Second World War. Quite apart from the theme of the movie, Turing is famous for conceiving of a general abstract and ingenious way of thinking about computers even before modern computers existed. A bit like Newton thinking about escape velocities before rockets existed. You may have heard of Turing machines or you can look them up on the Internet. Turing machines can be used to give a formal and rigorous demonstration that the arithmetic of functions, even when restricted to processing just simple counting numbers like 1,2 and 3, is so inherently complicated that there's no chance of building a mechanical device to do it. That's one of the most important results in mathematics in the first half of the 20th century, and was slightly shocking at the time. It says that function arithmetic is unavoidably interesting; never boring, in a way that can be made mathematically precise. Today, we've just introduced the concept of a composite function and illustrated it with some simple examples including a special case where the functions undo each other. This idea of undoing functions is explored in more detail in the next video. Please read the notes and when you're ready, please attempt the exercises. Thank you very much for watching and I look forward to seeing you again soon.