# Talk:Function composition

WikiProject Mathematics (Rated B-class, Top-priority)
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
 B Class
 Top Priority
Field: Basics

(*/Archive: someone's homework problem)

## I am surprised this article was not categorized so far. Thanks Paul.

Oleg Alexandrov 01:34, 16 Jun 2005 (UTC)

## typography

Any better way to write the operator than the current f o g? $f \circ g$?

Now I saw someone convert small o in another article into Unicode U+2218 ∘ so I looked at this again. 2218 seems to be the right character, but on Talk:Category theory someone points out that it "doesn't display correctly on some browsers, most notably Internet Explorer." Anyway, I suppose other articles in Wikipedia should follow the choice made in this article. See also Template_talk:Unicode. --TuukkaH 18:05, 3 October 2005 (UTC)
I agree that the unicode character is best. It doesn't display because IE just doesn't support Unicode. I use Mozilla.He Who Is 21:41, 4 June 2006 (UTC)

## negative functional powers

There is an error in the definition of negative functional powers. -- Wasseralm 19:51, 17 August 2005 (UTC)

I don't see it. Can you be more specific? Oleg Alexandrov 20:41, 17 August 2005 (UTC)
I fixed it. It basically said $f^{k}=(f^{-1})^k$. Rasmus (talk) 20:46, 17 August 2005 (UTC)
Looking at the timestamps, I had seen the article after the error was fixed. :) Thanks, Oleg Alexandrov 20:47, 17 August 2005 (UTC)
OK, this was the easy part. There is another intricate problem in the section, due to the fact that you consider f: X -> Y, where Y can be a proper subset of X. According to the definition of "composition" given at the beginning of the article, f o f cannot be formed (at this point). Intuitively (or with a slightly different definition of composition) f o f is defined and a function X -> Y. Thus all positive powers are defined. f^0 is a problem, becaus it has to be a function X -> X. It gets worse for the negative powers: If f: X -> Y is bijective, then f^(-1) : Y -> X. Thus, F^(-1) cannot composed with itself. To get rid of this problems, better take f : X -> X (compare the german article ("Deutsch"). Yours, -- Wasseralm 20:52, 19 August 2005 (UTC)
That XY should be sufficient for a bijective function f:X->Y to admit negative function powers, right? I added that as a condition. Btw. feel free to make any changes yourself. That is what a wiki is for after all! Rasmus (talk) 21:57, 19 August 2005 (UTC)
You write in your edit summary : "Functional powers - actually, for negative power of function to make sence one would need f:X->X.".
If f:X->Y is bijective, its inverse function f -1:Y->X should be self-composable if and only if XY. Of course in that case, unless X=Y, f is not itself self-composable, so it does not admit positive functional powers, but I do not see why it can't admit negative functional powers. Obviously it is not a necessary condition for negative functional powers that X=Y (quick counter-example: f(x)=2x, X=[0,1], Y=[0,2], f -1(x)=x/2 and f -2 is a nice function with domain [0,2] and codomain [0,0.5]). Rasmus (talk) 16:03, 20 August 2005 (UTC)

OK, you are right. But in this case I would claim we should not try to be too general. The condition f:X->X is in my opinion a very reasonable one to talk about negative functional powers. If the negative functional powers were a really important concept, then maybe it would be worth be general. But since it is just a curiosity, I would think it is not worth the trouble putting the most general condition.

But it is up to you. If you feel like going back to If f:X->Y with Y a subset X, be my guest. :) Oleg Alexandrov 17:34, 20 August 2005 (UTC)

It seems you must have Y = X. Otherwise, there is an element x in XY. If f is a bijection onto its image, then x has nowhere to go without making the proposed "inverse" function no-longer 1-1. Revolver 16:47, 7 October 2005 (UTC)

## Composition notation

We say:

"In the mid-20th century, some mathematicians decided that writing "g o f" to mean "first apply f, then apply g" was too confusing and decided to change notations. They wrote "xf" for "f(x)" and "xfg" for "g(f(x))". However, this movement never caught on, and nowadays this notation is found only in old books."

Does anyone have a reference for this? I'm sure I recall the left-to-right notation being used in my undergrad maths degree, which was only three years ago. — Matt Crypto 11:55, 19 August 2005 (UTC)

I've seen John Baez, who is thoroughly modern , use the left to right notation for composition, especially in the context of category theory. -Lethe | Talk 18:45, 3 October 2005 (UTC)
Edit: actually, I've seen Baez write gf for first act with g and then with f, but I have never seen him write xf for f(x). That notation seems pretty rare to me. -Lethe | Talk 18:48, 3 October 2005 (UTC)
Maybe you just didn't realise it. In any case, it is typical in category theory to conceptualise "elements" of a set as a certain type of morphism, so in that case, it would be perfectly correct and consistent to write xfg for g(f(x)). Revolver 16:47, 7 October 2005 (UTC)
There's another notation, which I think I saw in Jacobson's textbook, is xf for f(x). -Lethe | Talk 17:06, 7 October 2005 (UTC)
Just a passing note from a Haskell programmer: xfg and fg cannot both be correct type-wise, assuming an unambiguous definition of the notation. That is, h = f o g is correct, and Haskell has $for correctly expressing y = f$ g $x as well, but o and$ are not interchangeable. Of course, mathematicians needn't fear type errors like Haskell programmers need. In any case, you can see some programmers and programming languages prefer a left-to-right notation, such as cat file | sort | uniq for composition in shell. --TuukkaH 20:36, 3 October 2005 (UTC)
Is it worth noting that most (if not all) concatenative programming languages use a direct equivalent of the xfg syntax to express their programs? --Piet Delport 10:59, 2 January 2006 (UTC)

Sometmes I wish god had only given us only one hand. I suffer from terrible left/right confusion. A kind of dyslexia I suppose, for example I'm always confusing east and west. Which reminds me of the old conundrum: "why does a mirror reverse left and right, but not top and bottom?" Paul August 17:30, 7 October 2005 (UTC)

Having functions act on the right of their arguments is still quite common among algebraists. See, for instance, Smith's Postmodern Algebra for a recent book that does this. Since there are obviously some folks who have put a lot of time into this, I will not edit the paragraph myself, but I strongly recommend that it be rewritten to suggest that the other convention is still in common use.Mkinyon 21:22, 21 February 2006 (UTC)

Note the discussion of this convention at Group homomorphism. I will try to come up with a rewrite for the offending paragraph in the next few days. It is not correct as written, and the pseudo-historical "In the mid-20th century, some mathematicians..." is not up to encyclopedia standards. Michael Kinyon 21:37, 13 March 2006 (UTC)

## Fun with composition signs

JA: As for typography, these tricks work in some settings:

•  "ο"
• f ο g
• F ο G
• L ο M

JA: Jon Awbrey 03:20, 27 January 2006 (UTC)

## Derivative of composite function

Would a derivative of a composite function be a "composite derivative"?  ~Kaimbridge~ 20:23, 30 January 2006 (UTC)

I don't know what you mean by a "composite derivative". The derivative of a composition of two functions is given by the chain rule. Paul August 20:47, 30 January 2006 (UTC)
The "composition of two functions" is technically a "composite function", so I was just inquiring if its derivative would be a "composite derivative"——okay, I'll inquire over at chain rule.  ~Kaimbridge~ 20:15, 3 February 2006 (UTC)
• JA: A function that arises through the composition of functions is just a function. Once it's composed, you cannot say for sure where it came from, since the return decomposition is not in general unique. Hence its derivation, oops, mode of arising, is not its essence, in other words, not a part of its "ontology". Jon Awbrey 13:28, 14 March 2006 (UTC)

## Upper Limit of the Composition of Tan and Cos

Consider the graph of the following function:

$(tan\circ cos)^{\infty}(x).$

As the exponent converges to infinity, the function assumes a quizzical shape. A cyclical zig-zag made up of boxes set side by side. Wach one peaks at about 1.5614, and has a width of about 1.52. The latter seems to is about pi/2, which makes sense, since that makes pi its period. As for the former, I have been trying to find a connection between it and other known constants, and have yet to find anything. Any suggestions? He Who Is 21:54, 4 June 2006 (UTC)

What are f and g? -lethe talk + 21:57, 4 June 2006 (UTC)

Woops... Wasn't thinking when I wrote that. Tangent and cosine. Also, I looked at it more closely and realized that 1 is the maximum of cosx, and the peak of tancostancos...x is tan1. But I still think it is a rather interesting operation, since for everything between pi/4 + npi/2, for all integer n, it converges to tan1. Also, if one looks closely, you can see it has no zeroes, nor does it converge to zero. It actually grows to a value of about .002, shich I assume equals:

$\lim_{n\to\infty} (\tan\circ\cos)^n(0)$. He Who Is 22:00, 4 June 2006 (UTC)

Those are just the solutions of $(\tan\circ\cos)^2(x) = x$. Repeated iteration of $x \to f(x)$ will tend to attractors, such as fixed points of $f$. –EdC 17:08, 5 February 2007 (UTC)

## $(\sqrt x)^2$ undefined?

I'm a bit confused by the line "For example, $(\sqrt x)^2 = \sqrt{x^2}$ only when $x \ge 0$; for all negative $x$, the first expression is undefined." For x < 0 don't we have $(\sqrt x)^2 = (i \sqrt -x)^2 = i^2 (\sqrt -x)^2 = -x$? TooMuchMath 05:06, 20 September 2006 (UTC)

Not if f and g are defined to be real-valued functions, which I think is being assumed in the context. Profzoom 22:38, 26 September 2006 (UTC)
I have to go with TooMuchMath on this. The domain was not specified and the commmutativity is invalid anyhow. Let's not say $\sqrt x$ is undefined for $x < 0$ since this is false.--134.117.28.234 18:54, 30 November 2006 (UTC)
I agree with TooMuchMath's point on the domain not being specified, but it is true that the square root function and the square function commute under composition only for non-negatives. The last step in TooMuchMath's equation string is wrong: the two negatives should cancel to be a positive. Basically, $(\sqrt x)^2$ always returns the input, regardless of its sign, but $\sqrt{x^2}$ returns the number with the same magnitude as the input but with a non-negative sign, i.e., it is equivalent to the absolute value function. So for the square root and square functions to commute under composition for a particular number, that number must be the same as its absolute value: $x \ge 0$. David815 (talk) 23:39, 24 May 2014 (UTC)

## Something more general than function composition?

I'm wondering if there is something more general than function composition.

Example, I have a function f that maps elements of X onto real numbers. I use this function to define another function g that maps subsets of X onto real numbers--perhaps g gives an average, median, total, minimum, maximum etc.

How can I describe the relationship between f and g? Clearly I cannot say g is composed of f. I want to say something like g is 'based on' f. Anyone know of anything in the literature? If so, I guess there should be a link to funciton composition... —The preceding unsigned comment was added by 220.253.86.44 (talk) 00:03, 24 April 2007 (UTC).

Perhaps what you are looking for is the idea of an operator. Operators take one function as input, and spew out another function (or spew out a number, or a set ...). Operators that take two functions as input, and spew something out, are called binary operators. There are many, many operators. The classic example is D, which, given any function, spews out its derivative. One can certainly find ways of defining avg so that it is an operator. linas 03:01, 24 April 2007 (UTC)

Thanks for the suggestion and links. So, in my example, g would be an operator and f its operand. In this article composition is an operator, as is the function g o f. My main problem with this is that "operators" appear to be poorly defined and have multiple--conflicting--meanings.220.253.85.77 03:35, 26 April 2007 (UTC)

Don't know how to help you. As the article on operator says, an operator is "just a function". That's all, nothing more. That's neither poorly defined, nor is it conflicting. But you have to think "outside the box" to understand why "composition" (and things like it) are operators (i.e. are "just functions"). You have to answer the questions: what is the domain? what is the range? The domain and range of operators are typically not numbers of any sort. You might be looking for the concept of a dual space. In particular, you might be intersted in the space that is dual to the space of all functions-- see functional analysis. Or perhaps you're just looking for the concept of an integral -- the average of a function is just its integral...linas 04:53, 26 April 2007 (UTC)
To be fair, if an operator were "just a function" then there would be no point to operators at all! We already have functions! For operators to be useful, they must be a _type_ of function. There appears to be some ambiguity with precisely what type of function an operator is!InformationSpace 02:56, 27 April 2007 (UTC)
What you're talking may be related to a closure in computer science. It's a function that takes an argument and returns another function generated from that argument. Karl Dickman talk 21:05, 26 November 2008 (UTC)

## In the opening line...

...the functions f: X → Y and g: Y → Z can be composed by computing the output of f when it has an argument of g(x) instead of x.

Should this not be computing the output of g when it has an argument of f(x) ? Tobz1000 (talk) 17:01, 19 May 2009 (UTC)

They can be composed in either order, but the one you propose would match the second paragraph and the image better, so I swapped them. — Carl (CBM · talk) 17:32, 19 May 2009 (UTC)

For instance, the functions f : X → Y and g : Y → Z can be composed by computing the output of g when it has an argument of f(x) instead of x.

Shouldn't that last bit be instead of y, now that the example has been changed? I don't feel qualified to make an edit, but I conferred with a friend and we agreed that it seemed like the anecdote was g(f(x)), where f(x) replaces y in g(y). GeoffHadlington (talk) 03:27, 29 August 2013 (UTC)

I've rephrased it. The "instead of" was confusing to interpret. — Quondum 06:52, 29 August 2013 (UTC)

## Semicolon for functional composition

A further variation encountered in computer science is the Z notation: is used to denote the traditional (right) composition, but ⨾ (a fat semicolon with Unicode code point U+2A3E[2]) denotes left composition.

The unicode notation is left untranslated on my computer, even though I have Unicode Arial which works well most of the time. I suggest that someone with knowledge of this add an explanation about where to get the font that would render this symbol. Better yet, why not just refer to it as ";"? The details of Z code is a very special subject that may not belong in this article. SixWingedSeraph (talk) 14:58, 31 August 2009 (UTC)

Cambria (typeface) has it (because is M\$'s math font). JMP EAX (talk) 06:24, 24 August 2014 (UTC)
You can find a [partial] list of fonts that support it here. The article now mentions the semicolon too. JMP EAX (talk) 06:38, 24 August 2014 (UTC)

## Function composition always associative?

The statement that function composition is always associative is obviously false. The referenced page on associativity gives serveral examples of non-associative functions, including substraction over the integers and cross product of vectors. —Preceding unsigned comment added by 132.198.98.23 (talk) 22:54, 23 March 2010 (UTC)

Sorry, I was momentarily confused with terminology. Of course there is a difference between the order in which one collaspes a chain of maps (associativity of function composition) and the order in which one creates pairs in a sequence of operands for the application of a function of the form A X A -> A (associativity of a binary operator). The later is often but not alway associative. —Preceding unsigned comment added by 132.198.98.23 (talk) 23:55, 23 March 2010 (UTC)

## Typography again

As noted above in #typography about six years ago, the appropriate symbol appears to be Unicode U+2218: . I find it displays correctly on IE9 and Mozilla Firefox 8, and is used in List of mathematical symbols. The large circle symbol used in this article is a disconcertingly large workaround. Is there any reason (now that browsers may reasonably be expected to support the more common Unicode symbols) not to update this accordingly in the article? — Quondum 18:42, 11 May 2012 (UTC)

It depends less on the browser and more on the fonts installed. A list is here: [1]. Support for it is indeed much better than for (say) \fatsemi. JMP EAX (talk) 06:57, 24 August 2014 (UTC)

## commutativity and function composition

Regarding function composition for which g ∘ f = f ∘ g holds: Do composed functions which have this property have a dedicated name? Can they be considered symmetric functions? --Abdull (talk) 11:59, 18 July 2013 (UTC)

No, they can’t. Also, there is no such thing as “functions which have this property”, there are pairs of functions that commute, and this relation is not transitive. The nearest match to your query is a commutative subgroup of a group of transformations; see group action. Incnis Mrsi (talk) 12:37, 18 July 2013 (UTC)
Actually there is. It's called center of a semigroup. [2][3] JMP EAX (talk) 20:23, 23 August 2014 (UTC)
And for a chosen subset (rather than the whole group/semigroup) it's called a centralizer. JMP EAX (talk) 07:13, 24 August 2014 (UTC)
Of course the place where you should have learned that is the article on commutativity (in general), but that's the usual polished turd. JMP EAX (talk) 02:07, 26 August 2014 (UTC)