# Alternative form of ArcSin[Sin[x]]

Is it possible to get the following result in Mathematica by using only built-in functions:

$$\arcsin( \sin(x)) = x$$ if $$x \in [-\pi /2 , \pi/2]$$

$$\arcsin ( \sin(x)) = \pi - x$$ if $$x \in [\pi /2 , 3\pi/2]$$

• This should be reported as a bug, since ArcSin[Sin[x]] is correctly not simplified to x, whereas, as you note above, Sin[ArcSin[x]] is. – barrycarter Jan 8 '19 at 18:26

We can take the Floor and Ceiling from Carl's answer and expand them out:

PiecewiseExpand[
PowerExpand[ArcSin[Sin[x]], Assumptions -> x ∈ Reals],
-π/2 < x < 3π/2
] ## Edit

As it turns out, we can just pass the interval into PowerExpand:

PowerExpand[ArcSin[Sin[x]], Assumptions -> -π/2 < x < 3π/2] • Hello @ChipHurst, can you tell me why in the second line of the output there is True instead of "-pi/2<=x<=pi/2" please? – Gennaro Arguzzi Nov 7 '18 at 4:50
• We told PiecewiseExpand that our domain is restricted to -π/2 < x < 3π/2. Under this constraint, x > π/2 corresponds to π/2 < x < 3π/2 and True (I always read as 'otherwise' here) corresponds to -π/2 < x <= π/2. – Chip Hurst Nov 7 '18 at 12:57
• thank you very much for your elegant solution. – Gennaro Arguzzi Nov 7 '18 at 16:04

@kglr was on the right track with PowerExpand. With the default option Assumptions->Automatic, Mathematica may return a result that is not valid. On the other hand, if you give PowerExpand a non-default assumption, then it will return a result valid given those assumptions. So, for your example:

Assuming[
x ∈ Reals,
Simplify @ PowerExpand[ArcSin[Sin[x]], Assumptions -> x ∈ Reals]
]


1/2 (-1)^(Ceiling[1/2 + x/π] + Floor[-(1/2) + x/π] + Floor[1/2 + x/π]) (π + (-1)^( Ceiling[1/2 + x/π] + Floor[1/2 + x/π]) π + 2 x - 2 π Floor[1/2 + x/π])

• Hello @CarlWoll, I have some difficult to interpret the solution. Can you explain me how it is related to the solution which I expected (the one in the question) please? – Gennaro Arguzzi Nov 7 '18 at 4:52
• I am a bit puzzled by this solution; I would never have found it myself. My idea about PowerExand is that it has to do with expansion of powers and nothing with inverse trigonometric functions. Is there a mathematical or Mathematica reason that I should think of using PowerExpand for problems like these? – Fred Simons Nov 7 '18 at 8:53

Simplify[x == ArcSin[Sin[x]], -Pi/2 <= x <= Pi/2]
(* True *)

• Hello @UlrichNeumann, if possible i'd like to avoid to specify the range -Pi/2 <= x <= Pi/2. I prefer a more general statement because the above one is valid also for instance when Simplify[x == ArcSin[Sin[x]], 0 <= x <= Pi/2] – Gennaro Arguzzi Nov 6 '18 at 20:54
• @Gennaro Arguzzi You want to prove ArcSin[Sin[x]]=="triangle function"? – Ulrich Neumann Nov 6 '18 at 21:00
• I'm looking for built-in functions that allow me to "simplify" arcsin(sin(x)). – Gennaro Arguzzi Nov 6 '18 at 21:07

An easy way is to define a new function sin which will work as intended:

sin /: (ArcSin[sin[x :(_Real | _Integer| _Rational)]]
/;-(Pi/2)<=Mod[x, 2 Pi, -Pi/2] <= Pi/2) := x;
sin /: (ArcSin[sin[x :(_Real | _Integer| _Rational)]]
/; Pi/2<Mod[x, 2Pi,-Pi/2] < (3 Pi)/2) := Pi - x;
sin[x_] := Sin[x];


I intentionally restricted to real numbers (why I used heads Real, Integer, and Rational) so that I can use Mod.

Instead of trying to convert each Sin to sin, we can automate it by

\$Pre = Function[# /. Sin -> sin];


Now, we do not have to do anything: The code works as expected. For example

Plot[ArcSin[Sin[x]], {x, -Pi, 3 Pi}] 