15

I have a question. When I write the integral of a generic function $f(x)$, do I have to write $$\int f(x) \color{red}dx$$ or $$\int f(x) \color{red}{\mathrm{d}}x \quad ?$$ Why?

Thank you!

user36390
  • 311
  • 4
    @John I disagree. The question is about mathematical notation and has nothing to do with the site itself. – beep-boop Aug 21 '14 at 18:01
  • 3
    Some people have a preference to use an upright roman $\mathrm{d}$ as opposed to an italics $d$. This is done to emphasis the fact that $\mathrm{d}$ is an operator (differential). – Gahawar Aug 21 '14 at 18:04
  • 2
    A possibly interesting consequence of using $\mathrm d$ is that there is less confusion if you decide to use $d$ as a variable: $\int f(d)\mathrm{d}d$. – Dejan Govc Aug 21 '14 at 18:05
  • @alexqwx Gotcha. I'll delete my comments. – John Aug 21 '14 at 18:11
  • @alexqwx: I've thought about using it. For example in geometric problems where your variable might be interpreted as some kind of a distance, it seems natural to denote it by $d$ and then the need to differentiate it might arise. But yes, the idea is a bit silly, so I usually change notation at that point. – Dejan Govc Aug 21 '14 at 18:18
  • 1
    @DejanGovc Ah, fair enough. (I also didn't consider the possibility of $d$ being a parameter) – beep-boop Aug 21 '14 at 18:19
  • The italicized d looks better because it compliments the slant of the integral – zerosofthezeta Aug 22 '14 at 05:59
  • See also here: https://nickhigham.wordpress.com/2016/01/28/typesetting-mathematics-according-to-the-iso-standard/ – Frunobulax Jan 31 '16 at 11:12

4 Answers4

10

$$\int f(x) dx$$ is just fine, though some people, as a matter of preference, write $$\int f(x) \mathrm{d}x$$ (perhaps to indicate that we are not taking the product of $d$ and $x$.) Just as there are folks, like me, who like to insert space between the function and $dx$: E.g. $$\int f(x)\,dx$$

But rest assured that the appearance of the integral sign makes the use of plain-old $dx$ pretty self-evident.

amWhy
  • 209,954
  • 3
    Is writing $$\int f(x) dx$$ rather than $$\int f(x) \mathrm{d}x$$ as erroneous as writing $cos$ instead of $\cos$ (or is it simply a matter of personal preference?)?

    And out of curiosity, why do you leave a space between the integrand and the $dx$?

    – beep-boop Aug 21 '14 at 18:04
  • 1
    Actually, I prefer $\int f(x),\mathrm dx$. :) – Hagen von Eitzen Aug 21 '14 at 18:12
  • 4
    The font for the d is a matter of personal choice, though it might be helpful to use the Roman d if there happens to be a parameter $d$ somewhere nearby. The space can be helpful if the $f(x)$ is replaced by something else, especially if it doesn't end with a parenthesis: $\int abcdxdx$ would be really bad compared to $\int abcdx; {\rm d}x$. – Robert Israel Aug 21 '14 at 18:12
  • 7
    According to ISO standards, the differential operator must be typeset in roman (\mathrm) and have spacing like an operator on the left side with no spacing on the right side. The form f\, \mathrm dx is the proper one. This rule is often neglected but it is still the ISO standard. – user157227 Aug 21 '14 at 18:36
  • @user157227: do you have a link for said ISO standard, or an address within the standard where this is specified? – abiessu Aug 21 '14 at 18:42
  • The ISO standard is consistent with other mathematical conventions, but there are who knows how many textbooks and reference books out there that typeset integrals as $\int \ldots dx$ instead of $\int \ldots\mathrm dx$. So you need to be prepared to read integrals typeset that way, and if you typeset them that way yourself, some people will notice you're violating ISO but you'll usually get away with it. – David K Aug 21 '14 at 18:48
  • @abiessu Here is a link describing the rules http://tug.org/TUGboat/tb18-1/tb54becc.pdf . It is a bit dated but I doubt there has been a significant change. – user157227 Aug 21 '14 at 18:50
  • 1
    @DavidK My entire PhD thesis included $\frac{dy}{dx}$ and $\int f(x),dx$. Every paper that was published as a result changed all of the $d$ to $\mathrm{d}$. – Fly by Night Aug 21 '14 at 19:49
  • 2
    I have the same preference as amWhy has (I also use the space). I had thought that the upright $\mathrm d$ was mainly used by physicists/engineers and mathematicians preferred italic $d$, but maybe I'm wrong here. – J. J. Aug 21 '14 at 19:59
8

The underlying rule (which is often violated) is that variables should be in italic, but names should not. In ${\rm d}x$, $x$ is a variable which could be exchanged with any other letter, but ${\rm d}$ is the name of the differential operator and cannot be exchanged with any other letter.

For the same reason, a general function $f$ is in italic, but the particular functions $\sin$, $\cos$, $\log$ are not. Similarly, numerals are names of particular numbers, and are therefore not italicized.

  • 3
    When I define $f(x):={1\over1+x^2}$ then $f$ has become a name. Should I then write ${\rm f}$ instead of $f,$? – Could you give some reference for this "underlying rule"? – Christian Blatter Aug 21 '14 at 19:36
  • This is interesting. I found myself nodding along until the function part. Cambridge University use bold characters for functions, e.g. $\mathrm{f}(x) = x^2$. According to their typesetting, functions like $\mathrm{f}$, $\cos$, $\ln$ - as well as operators - ought to be in roman. – Fly by Night Aug 21 '14 at 19:43
  • @ChristianBlatter What you say is in agreement with the Cambridge typesetting standard. Functions are in Roman. They also write the imaginary unit as $\mathrm{i}$. – Fly by Night Aug 21 '14 at 19:45
  • 1
    And in Cambridge is there a difference between a specific function $\mathrm{f}(x) = x$ and a variable of function type, "let $f$ be a continuous function"? – Steve Jessop Aug 21 '14 at 21:12
  • 1
    @ChristianBlatter I think not, but I see the Cambridge typesetting standard disagrees with me. From this description of the ISO standard, "italic symbols should be used only to denote those mathematical and physical entities different values," and "Any other symbol that was not dealt with in the preceding section must be set in roman font". It is my interpretation that if something cannot assume different values then it is because it is the name of something. – Per Erik Manne Aug 22 '14 at 08:46
  • @FlybyNight: Cambridge does set $\mathrm f$ in upright Roman, but not in bold. –  Apr 06 '23 at 02:09
  • @user24096 Thanks, that was a typo. I type-set a roman f and not a bold one. That's what I really wanted to say :-) – Fly by Night Apr 18 '23 at 20:28
8

As pointed out in another answer, the notation $\int \ldots\mathrm dx$ is consistent with the typesetting of other mathematical symbols, since $\mathrm d$ is the name of a specific operator. There is also an ISO standard governing these things, which purportedly specifies $\int \ldots\mathrm dx$ as the correct notation, but a copy of the latest standard, which apparently is ISO 80000-2:2009, costs $158$ Swiss francs (about US\$$173$ according to today's exchange rate) and I don't have ready access to one as far as I know.

So it would seem that technically, you should write $\int \ldots\mathrm dx$, but hundreds of years of convention, countless textbooks and reference books, and millions of people who have been accustomed to seeing $\int \ldots dx$ for most of their lives (and who have never even considered that there was likely an ISO standard governing the notation, as I had not until today) all say that as a practical matter you do not have to write $\int \ldots\mathrm dx$.

If you do write $\int \ldots\mathrm dx$ and someone complains that it should have been $\int \ldots dx$, however, now you have the resources to back up your choice.


Update for $2023$: For some time now, I personally have been writing $\int \ldots \mathrm dx$ in my posts here. Also $\dfrac{\mathrm d}{\mathrm dx}.$ But I will sometimes use the older notation when responding to someone who seems to prefer it.

David K
  • 98,388
  • I can confirm on the ISO standard aspect: in a free preview of NEN-ISO 80000-2:2009 which seems to be the Dutch approved verbatim copy of ISO 80000-2:2009, near the beginning of section 3, it says: "Well-defined operators are also printed in Roman (upright) style, e.g. $\textrm{div}$, $\unicode{x3B4}$ in $\unicode{x3B4} x$ and each $\textrm d$ in $\textrm d f / \textrm d x$." Note that the delta character here is Unicode codepoint U+03B4, not U+1D6FF. – MarnixKlooster ReinstateMonica Aug 21 '14 at 21:13
  • Apologies, that comment did not come out right because of the font. I used the correct Unicode codepoint, but apparently to show U+03B4 properly 'upright' in at least my browser, I need to use the Times font, as in \unicode[Times]{0x3B4}: $\unicode[Times]{0x3B4} x$. – MarnixKlooster ReinstateMonica Aug 22 '14 at 06:07
  • Typesetting standards should, if at all, be formulated by the mathematical community as a whole, and not by some self-appointed black box named ISO. E.g., in the sheet quoted by Marnix Klooster, they advocate writing $\sin n\pi$ which no mathematician would do. – Christian Blatter Aug 22 '14 at 08:10
  • @ChristianBlatter: What's wrong with $\sin n\pi$? I'm no mathematician, and I don't see anything wrong with it. – celtschk May 15 '15 at 21:00
  • @celtschk In the ISO preview, the symbol $\pi$ is shown in upright form rather than in italics. But MathJax apparently does not even make it possible at this time to show an upright $\pi$ in a math formula (which just goes to show how much the ISO recommendation has influenced mathematical writing), so I can't show in this comment how the $\pi$ in the previous comment was supposed to look. – David K May 15 '15 at 21:56
  • @celtschk: With $\sin$, $\log$, etc., it is allowed to omit the parentheses normally used for function application. The intended input to the function is the first group after the $\sin$. Therefore $\sin>n\pi=\pi>\sin n$, but $$\sin\alpha,\quad \sin(\pi x), \quad \sin{2k\pi x\over L}$$ are o.k. – Christian Blatter May 16 '15 at 08:30
  • I've added an answer with the relevant quotes from the ISO document. –  Apr 06 '23 at 02:10
2

From ISO 80000-2:2019(E) (second edition, 2019-08, p. 1):

Variables such as $x$, $y$, etc., and running numbers, such as $i$ in $\sum_{i}x$ are printed in italic type. Parameters, such as $a$, $b$, etc., which may be considered as constant in a particular context, are printed in italic type. The same applies to functions in general, e.g. $f$, $g$.

An explicitly defined function not depending on the context is, however, printed in upright type, e.g. $\sin$, $\exp$, $\ln$, $\Gamma$. Mathematical constants, the values of which never change, are printed in upright type, e.g. $\mathrm{e}=2,718\,281\,828\,\dots$; π $=3,141\,592\,\dots$; $\mathrm{i}^{2}=-1$. Well-defined operators are also printed in upright type, e.g. $\mathbf{div}$, δ in δ$x$ and each $\mathrm{d}$ in $\mathrm{d}f/\mathrm{d}x$.

So, if we've set $e=10$, then $e\mathrm e =27.182\,818\,\dots$.

If we've set $i=2$, then $(i \mathrm i)^2 =-4$.

If we're using $d$ as a variable, then $\int d \,\mathrm d d = d^2/2+C$.


A comment to an answer here asks,

When I define $f(x):=\frac{1}{1+x^2}$ then $f$ has become a name. Should I then write $\mathrm f$ instead of $f$?

My answer based on (my interpretation of) the above ISO convention: No, because the function $f$ can vary depending on the context.

(As noted in the comments there, Cambridge deviates from the ISO convention and sets functions $\mathrm f$, $\mathrm g$ in upright Roman. But not in bold as claimed in one comment.)