 Let's briefly talk about a very important operation on functions, which is known as function composition It'll be denoted by this little circle that we put in between the function symbol for latex This would be backslash c i r c short for circle right there The function composition operation is the following it puts functions It's gonna glue two functions together in sequence people often like to think of the function Idea metaphorically as like a machine right so we have some machine which we're going to call g for which you could take any Number in its domain you can stick it in there, and it'll output a different number G of x so you might think of something like the following imagine I have a soda factory and I want to have a machine that will fill up a bottle soda based upon like a timer right and So we're gonna fill up a soda bottle Let's say contains eight fluid ounces and which case oh we have to our machine people accept any Container that can hold eight fluid ounces of soda now typically that'll be like a bottle empty bottle of some kind But we could put like an empty bucket or an empty bowl in there It's if it's large enough that will be an acceptable thing inside of its domain And then the thing it outputs would be that bottle or bowl or bucket that has now been filled with eight fluid ounces of our soda Then perhaps we have another function right here We'll call it f Which it'll accept numbers as its input and it'll it'll have some type of output right x would come in and I'll put f of x And so let's take continue with our soda factor example Let's say f right here This is a function which it'll be a machine that stamps and seals bottles right so it puts a bottle cap on top of the Bottle it can accept as its input any type of bottle it doesn't matter if there's anything in it It would take an empty bottle it would seal it it would take a Filled bottle and seal it it just has to be the bottles the right dimensions, okay? So function composition what we're gonna do is we're gonna put the two functions together right we put them together in sequence So x goes inside of g gets processed it spits out g of x then g of x becomes the input of f of x And then the thing that comes out of it would be f of g of x Like so in which when you put this thing together we call this f of g and therefore the output is f of g of X and so for example the first machine would accept an empty bottle It fills it up with soda then we take that empty ball or that filled bottle and put inside the second machine It'll then seal it with a bottle cap and then the output will be a sealed bottle of Soda and so that's that's how these things work But the domain and co-domain of these things do matter right so f is gonna be a function from b to c and g It's gonna be a function from a to b here And so working right to left the reason we do this is because the input We always write on the right-hand side here in the United States other countries might have different conventions Some people write the input on the left side. I mean, although that's there's no reason you can't do that Mathematically just feels a little bit weird to an American audience here So we have these sets a b and c for which a is gonna transform into something and b and then something and b It's gonna transform something into c there, right? So f will transform a into b and then g I wrote that backwards. I'm sorry G will transform something from a into b and then f will transform something from b into c And so that's the that's the composition of the two functions We put these things together the things coming out of g need to be something inside of inside of b right here And this is where that idea of domain and co-domain comes into play right here in order for this function composition to work the co-domain of F Sorry, I did that one backwards again. Sorry the the first function here is g the co-domain of g has to be the domain Of f the things coming out of g have to be compatible the things going inside of f if you have this Incompatibility this would be not well defined whatsoever So the the co-domain of the first function has to be the Domain of the second function where the first function actually shows up on the right I'm a simple example of such a thing take f of x equals x cubed and g of x equals e to the x right in this situation remember our Functions had the following property f was a function from the real numbers to the real numbers G was a function from the real numbers to the We'll just say the real numbers even though the output Will never be negative for e to the x there and so if we put these things together, right? We put g inside of f that means we're going to take e to the x and we're going to cube that and by exponent rule as you get e to the 3x Now be aware that the the range the image of g is not all real numbers But the output of g is a real number and therefore it's compatible to go inside of the function f This is why it's kind of important distinguished between the image and the co-domain I don't actually care in terms of composition what the co-domain or what the what the image is the co-domains would matters Right the thing coming out has to be a real number Even if not everything not every real number can come out of the composition of these two functions