is an attribute that can be assigned to a symbol f to indicate that f[x], f[f[x]], etc. are all equivalent to x for the purpose of pattern matching.


OneIdentity
is an attribute that can be assigned to a symbol f to indicate that f[x], f[f[x]], etc. are all equivalent to x for the purpose of pattern matching.
Details

- Functions like Plus and Times have the attribute OneIdentity.
- The fact that Times has attribute OneIdentity allows a pattern like n_.x_ to match x.
Examples
open all close allBasic Examples (1)
The pattern matches, because Times has attribute OneIdentity:
Any function with attribute OneIdentity will match:
Properties & Relations (2)
OneIdentity allows defaults to apply to expressions that do not involve Times at all:
For Flat functions, any sequence of arguments will match Blank:
When f is both Flat and OneIdentity, f[x_] will attempt to match x_ to a rather than f[a]:
Possible Issues (1)
In order for f[a] to match a, you must use a pattern that includes Optional:
Similarly, the following pattern fails because f has no defined defaults:
Tech Notes
Related Guides
-
▪
- Attributes ▪
- Patterns
History
Introduced in 1988 (1.0) | Updated in 2003 (5.0)
Text
Wolfram Research (1988), OneIdentity, Wolfram Language function, https://reference.wolfram.com/language/ref/OneIdentity.html (updated 2003).
CMS
Wolfram Language. 1988. "OneIdentity." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/OneIdentity.html.
APA
Wolfram Language. (1988). OneIdentity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OneIdentity.html
BibTeX
@misc{reference.wolfram_2025_oneidentity, author="Wolfram Research", title="{OneIdentity}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/OneIdentity.html}", note=[Accessed: 16-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_oneidentity, organization={Wolfram Research}, title={OneIdentity}, year={2003}, url={https://reference.wolfram.com/language/ref/OneIdentity.html}, note=[Accessed: 16-August-2025]}