11

Several people have told me that $\sin(x)^2 = \sin(x^2)$. However, on several computing platforms, such as the TI-84 and Wolfram|Alpha, $\sin(x)^2 = \sin^2(x)$. Can I safely conclude that the notation $\sin(x)^2$ is ambiguous and should always be avoided in favor of $\sin^2(x)$ or $\sin^2 x$? I am having trouble finding any reference through Google or in textbooks (which, I presume, avoid notation like this).

Ali Caglayan
  • 5,726

3 Answers3

34

No-one in their right mind would denote $\sin\left(x^2\right)$ as $\sin(x)^2$.

Why? Because the (round) brackets would become redundant. Brackets are used to remove ambiguity in algebraic operations. If you exclude the exponent $\quad ^2 \quad $ from the brackets, you're implicitly saying that the $\quad ^2 \quad$ belongs outside the brackets, and, therefore, we're taking the square of the sine, rather than the sine of the square.

In short, $$\sin(x)^2 \ \equiv[\sin(x)]^2 \ \equiv \ \sin^2(x) \ \neq \ \sin\left(x^2\right) \quad.$$


In some contexts, however, for a given function $f$, we have $$f^2(x) \ \equiv \ f\left[f(x)\right] \ \equiv \ f \circ f(x) \ \neq \ [f(x)]^2 \quad ,$$ so, if in doubt, explicitly define notation to remove all ambiguity.

beep-boop
  • 11,595
  • 2
    Your first line holds if it is only about a single variable. However, if x is defined as y+z you could see sin(y+z)^2 meaning sin((y+z)^2) – Dennis Jaheruddin Sep 16 '14 at 12:36
  • @DennisJaheruddin Agreed. – beep-boop Sep 16 '14 at 12:39
  • Just worth pointing out that many people have thought the $sin^2$ notation (meaning the square of the sine) senseless for a long time, for example Charles Babbage[0]. I cannot understand how any right thinking person would use it, but many still do.

    [0] http://books.google.ie/books?id=gkWunaISTsgC&lpg=PA171&ots=fC_q8JHZBU&dq=babbage%20sin&pg=PA171#v=onepage&q=babbage%20sin&f=false

    – Sean D Sep 16 '14 at 14:16
  • As David has pointed out in the comments in the below answer, $\sin[\sin(x)]$ is less common than $[\sin(x)]^2.$ – beep-boop Sep 16 '14 at 14:34
7

If anything, $\sin^2(x)$ is the ambiguous notation. To some it might mean $\sin(\sin(x))$ (this is why $\sin^{-1}$ is sometimes used as arcsine), and to others it might mean $(\sin(x))^2$. I cannot think of a case where anyone would see $\sin(x)^2=\sin(x^2)$ (except when, say, $x=0$). However, we mathematicians avoid ambiguity; I typically use $(\sin(x))^2$ when I square my sines.

  • 4
    I've always disliked how, unless I'm misunderstanding, sin^-1 represents a different function for inverse sine and sin^2 is just squaring the result of the function. It's always seemed a bit inconsistent. – Ashley Davies Sep 15 '14 at 23:26
  • 9
    $\sin(\sin x)$ is extremely rare, whereas $(\sin x)^2$ is pretty common. As such, it makes much more sense for $\sin^2 x$ to mean the latter, even though it is, as you say, inconsistent with $\sin^{-1} x$. – David Richerby Sep 16 '14 at 00:05
  • 1
    in my country $sin^{−1}x$ is never seen outside pocket calculators. To mention the inverse function of sin one would always use arcsin – phuclv Sep 16 '14 at 15:18
  • 1
    Honestly, when I use $\sin^{-1}$, I'm not talking about a function; I use that to denote the preimage. – Robin Goodfellow Sep 16 '14 at 15:22
  • +1, I guess that this ambiguity might even be the one that was actually meant here (since, as others have pointed out, the other one does not make any sense at all). I'd go for $sin^{2}(x) = sin(sin(x))$ in any case. – Marco13 Sep 17 '14 at 08:50
-4

In mathematics, $\sin (x)^2 = \sin x^2 = \sin (x^2) $ because $\sin$ comes after exponentiation and multiplication in order of operations. The $sin^2$ construct was created to alleviate the pain of performing exponentiation on the result of $sin$.

In computer programming, however, $ \sin(x)^2 = \sin^2 x $ because $\sin$ is a function call and the expression within the parentheses is its only parameter.

Consider, for example, how redundant it would look to write $\sin (x+1)^2$ as $\sin [(x+1)^2]$.

Adam Hughes
  • 36,777
John
  • 9
  • 1
    What do you mean by "In computer programming, $\sin(x)^2=\sin^2 x$? Expressions such as "$\sin(x)^2$" do not appear in any programming language I'm familiar with. Squaring is typically not a primitive operation but is implemented either by explicitly multiplying a term by itself or by using a function such as pow(x,y) that computes $x^y$. There's no ambiguity in pow(sin(x),2), sin(x)*sin(x) or t=sin(x); ans=t*t. – David Richerby Sep 16 '14 at 08:41
  • 5
    It's always dangerous to talk about programming languages as if they were all the same. In Python, sin(x) ** 2 is $(\sin x)^2$ since brackets are part of the function application notation. But in Haskell, sin (x) ^ 2 is $(\sin x)^2$ for a different reason (function application precedes all binary operations). Then, in J, sin (x) ^ 2 is $\sin(x^2)$ due to right-associativity.

    Also, esoteric languages like Unlambda will always be exceptions.

    – mudri Sep 16 '14 at 09:41
  • 1
    What is your justification and/or authority that "sin comes after exponentiation and multiplication in order of operations?" Is there some convention I am unaware of? Among whom? – Resigned June 2023 Sep 16 '14 at 23:10
  • The first paragraph is utterly incorrect. (-1) – Xander Henderson Mar 19 '23 at 00:44