Skip to main content
Search IntMath

What’s the correct graph of sec(arccos(x))?

By Murray Bourne, 29 Jan 2017

A recent question on the IntMath Forum by Shay asked:

I have the problem sec(arccos 5) and I understand that sec is the reciprocal of cos. But if the domain of arccos is [0,pi] then how can this be 1/5?

This looked interesting and reminded me of a similar issue I wrote abvout before, What is the correct graph of arccot x?.

First, I gently corrected Shay's statement (to point out that the range of arccos is [0,pi], not the domain).

Then I investigated it further with him. Here's some more information.

Some background - inverse cosine

NOTE: The function y = arccos(x) is written in most text books (and on your calculator) as y = cos−1(x). I don't like the latter notation for many reasons (especially because students confuse it with "reciprocal"), so I use the first throughout this article.

Arccos is the inverse cosine function. That is, it works "backwards" compared to the cosine function. You give it a ratio, and it returns an angle (whereas for cosine, you give it an angle, and it returns a ratio).

Examples - cos and inverse cos

cos(60°) = 0.5

arccos(0.5) = 60°

Taking the cos of arccos

Now, since cos and arccos are inverses of each other, it follows that

cos(arccos(x)) = x


arccos(cos(x)) = x

But is this always true?

Actually, no.

The graph of y = cos(arccos(x)) starts at (−1,−1) and finishes at (1,1), as you can see below. It's not the "full" graph, y = x, as claimed above.

Graph of cos(arccos(x))
On the other hand, the graph of y = arccos(cos(x)) continues for all x-values, in a saw-tooth pattern involving π, as follows.

Graph of arccos(cos(x))

Clearly, neither of the above two graphs is the simple function y = x.

Why is this happening?

The function y = arccos(x) is only defined in the domain −1 ≤ x ≤ 1, (see more in Inverse Trigonometric Functions) so it follows that the cosine of that function, that is

y = cos(arccos(x)),

must also be defined only in that domain.

However, the function y = cos(x) is defined for all x, so when we take the arccos of that function,

y = arccos(cos(x)),

it will be defined for all x as well.

For further background on the domain of a function of a function, see Domain of a Composition (PDF), where it states:

The domain of fg is the set of all real numbers x in the domain of g such that g(x) is in the domain of f.

Let's return to the original question.

What is the graph of y = sec(arccos(x))?

Since the secant function is defined as:




We learned above that cos(arccos(x)) is only defined for −1 ≤ x ≤ 1, and it has value x in that domain.

So we have:


for −1 ≤ x ≤ 1, except x = 0.

Let's now have a look at how some software packages graph it.

Software graphs of y = sec(arccos(x))

Desmos shows it clearly as having domain −1 ≤ x ≤ 1, except x = 0.

Desmos - graph of sec(arccos(x))

This is the same result as given by JSXGraph:

JSXGraph - graph of sec(arccos(x))

My own Asvg-IM.js also gives the same result.

Asvg-IM.js - graph of sec(arccos(x))

On the other hand, Scientific Notebook gives us the following, with domain all x except x = 0.

Scientific Notebook - graph of sec(arccos(x))

Wolfram|Alpha case

Now, finally, here's how Wolfram|Alpha shows it - with all values of x included, except 0, the same as Scientific Notebook.

Wolfram|Alpha - graph of sec(arccos(x))

So which is the correct graph?

I said in the forum post that I would follow this up with Wolfram|Alpha. I did, and they responded with:

We appreciate your feedback. After review, our internal development group believes the output given is correct:

Domain arcCos gives a complex result whenever x is larger than 1 or smaller than -1, but Sec can still operate on complex numbers to give real values.

For more information please see here.

If you still disagree, please elaborate by providing source links to the specific information that you are interested in seeing.

(That second link was not that helpful.) It wasn't a case of my disagreeing with their result, I was more intent on getting them to make their result more clear.

Arccos x by Wolfram|Alpha

When using the query arccos x (without the "sec"), Wolfram|Alpha first gives the real-valued plot (with domain −1 ≤ x ≤ 1), then goes on to provide the following plot, which has both real parts and imaginary parts shown.

Wolfram|Alpha - graph of arccos(x) - real and imaginary

That's good for anyone investigating the function - giving the real case (the one most often needed by undergraduate students of mathematics), then following that with the imaginary case, and stating clearly what is going on.

It was with this in mind that I replied to Wolfram|Alpha with:

Thank you for following up on this - I do appreciate it.

For the W|A result for arccos(x), it clearly separates out the real result and complex result in 2 separate graphs.

I'm wondering if the same approach would make the result for sec(arccos(x)) more understandable. That is, have one graph for the case where x is real (with domain [-1,1], ≠ 0, and another for when x is complex (all x ≠ 0,). Would that still be mathematically sound?

I received a reply:

Thanks for the feedback. I'll pass this on to the developers.

Up to now, there hasn't been any change in the result given for sec(arccos x).

Real properties of sec(arccos x)

Underneath the Wolfram|Alpha graph of sec(arccos x), it states some "Properties as a real function", as follows:

Wolfram|Alpha - properties of real sec(arccos(x))


So this is the solution for Shay's question - if we allow for complex values, the domain of sec(arccos x) is "all x except 0" (and the "correct" graph would be the one given by Scientific Notebook and Wolfram|Alpha), but for real values, the function is only defined for −1 ≤ x ≤ 1, except x = 0 (and the "correct" graph would be the one given by the other software packages).

So the answer to his original question is


assuming 5 is a complex number (which it can be - if the imaginary part happens to be 0), and it is undefined if the function is real.

See the 9 Comments below.

9 Comments on “What’s the correct graph of sec(arccos(x))?”

  1. Alan Cooper says:

    Hi Murray, I am puzzled by your objection to Shay's use of "reciprocal" (especially as it doesn't show up in your response on the forum page).

  2. Murray says:

    Hi Alan

    Oops - it does show up now! (I thought I had done so when the forum question first came in - obviously I hadn't.)

    Thanks a lot for alerting me.

  3. Alan Cooper says:

    But I think you may have misread what Shay wrote. It refers to sec (not arccos) as the reciprocal of cos - which I am glad to see we both think is correct.

  4. Murray says:

    It's probably obvious I'm juggling way too many things right now. I corrected the forum response and the above post...

    Thanks again for keeping me honest. Isn't it the middle of the night where you are...?

  5. Alan Cooper says:

    Yes, I'm a bit of a nightowl anyhow, but foolishly did one last check of my email just before going to bed after already having stayed up late sorting old photos.

  6. Ned says:

    That is a very interesting topic. I have been thinking a lot about that myself. The best solution for me is to allow the user to choose whether to work in real or complex mode. This is how Calcpad is made. Open the online calculator: and paste the following code:

    f(x) = 1/cos(acos(x))
    $Plot{x|f(x) & -x|f(-x) @ x = 0.1 : 2}

    Press 'Enter' or click 'Refresh' to get the result. The plot is limited within [-1; 1]. If you switch to 'Complex', it is not limited anymore. So, I think you are right: Both graphs are correct as long as you know if you are working with real of complex numbers.

    However, the complex math could be frustrating for younger students, so it is always good to have such a 'Real/Complex' switch.

  7. Murray says:

    @Ned: Thanks for the input.

    BTW, I did try your code in CalcPad just now, but was shown a Russian version (which I can read a little bit, but it's probably not what you intended).

  8. Ned says:

    Sorry, my fault. Please use instead.

  9. Murray says:

    I updated your earlier post to point to the English version.

Leave a comment

Comment Preview

HTML: You can use simple tags like <b>, <a href="...">, etc.

To enter math, you can can either:

  1. Use simple calculator-like input in the following format (surround your math in backticks, or qq on tablet or phone):
    `a^2 = sqrt(b^2 + c^2)`
    (See more on ASCIIMath syntax); or
  2. Use simple LaTeX in the following format. Surround your math with \( and \).
    \( \int g dx = \sqrt{\frac{a}{b}} \)
    (This is standard simple LaTeX.)

NOTE: You can mix both types of math entry in your comment.


Tips, tricks, lessons, and tutoring to help reduce test anxiety and move to the top of the class.