I have more complex functions than this, but say I just have:


The function is not defined for x==2. I would like to find the value of the parameter a, so that I have only a removable discontinuity there, and not an essential (or infinite) one. Clearly, for this simple example, I want a to equal 2. I searched around quite a bit, but came up empty-handed.

My first thought was to require that the two one-sided limits would equal each other, i.e.:

Reduce[Limit[f[x], x -> 2, Direction -> "FromBelow"] ==
    Limit[f[x], x -> 2, Direction -> "FromAbove"], {a}, Reals]

however the result is:

Reduce::infc: The system (-2+a) ∞ == (-2+a) (-∞) contains
    an infinite object ∞.

The problem results from the fact that the Limit[]s happen before Reduce[] gets a chance to try out various values of a. At this point, I could cheat, replacing the ∞ with 1 and -∞ with -1, and then feed it to Reduce[]. But, that would be cheating, and also would only work for this specific case. FindInstance[] was no further help.

NLimit[] (with Chop[] if necessary) from the NumericalCalculus package would not work, as it requires the function to be numeric -- not the case here with the parameter a.

Moving on, I thought of going back to the definition of a limit. The following is shamelessly (shamefully?) snarfed and adjusted from the "Neat Example" at the end of the Reduce reference page:

Reduce[ForAll[ϵ, ϵ > 0,
    Exists[δ, δ > 0,
    ForAll[x, Element[x | a, Reals] && 0 < x - 2 < δ,
    RealAbs[f[x] - f[4 - x]] < ϵ]]], a]

(Trust me, it looks a lot nicer with all of the Greek characters and mathematical symbols in there. :-) )

This nicely did the job, producing: a==2. This even worked for a (only slightly?) more complex:

g[x_] := f[x]^4 - f[x]^2 + 1

However, it did not work for:

h[x_] := Sin[f[x]]

So, my question is: does anyone have an idea how to get this to work for more general functions with parameters, with either of the above forms of Reduce[], or perhaps another approach?

Thank you all for your time and ideas.


2 Answers 2


You could do a series expansion, find all the poles, and set them to 0. Here is a function that does this:

removable[expr_, x_->v_, param_] := Module[{poles},
    poles = Cases[
        Series[expr, {x, v, -1}],
        HoldPattern@SeriesData[a__, max_, 1] :> SeriesData[a, 0, 1][[3]],
        {0, -1}
    Solve[Flatten @ poles == 0, param]

For your examples:

removable[(x-a)/(x-2), x->2, a]
removable[((x-a)/(x-2))^4-((x-a)/(x-2))^2+1, x->2, a]
removable[Sin[(x-a)/(x-2)], x->2, a]

{{a -> 2}}

{{a -> 2}}

{{a -> 2}}

A slightly more complicated example:

removable[(x^2-a x-2a^2)/(x-2) + Sin[(x-b^2)/(x-2)], x -> 2, {a, b}]

{{a -> -2, b -> -Sqrt[2]}, {a -> 1, b -> -Sqrt[2]}, {a -> -2, b -> Sqrt[2]}, {a -> 1, b -> Sqrt[2]}}

  • $\begingroup$ Carl, thank you very much for this answer. I should have pointed out that I am teaching Calculus I, and therefore would like to stick to the relevant Calculus I mathematics of limits and continuity. In other words, I would like to solve this problem with more Mathematica, rather than more mathematics. Any ideas? $\endgroup$ Oct 26, 2018 at 7:29

One way to find the location of the discontinuities is to find the domain of the function. For your example, this gives:

f[x_] := (x - a)/(x - 2);
FunctionDomain[f[x], x]
x < 2 || x > 2

This also works for your other examples:

g[x_] := f[x]^4 - f[x]^2 + 1;
h[x_] := Sin[f[x]];
{FunctionDomain[g[x], x], FunctionDomain[h[x], x]}
{x < 2 || x > 2, x < 2 || x > 2}
  • 2
    $\begingroup$ I think the OP wanted to extract the value of a, not the location of the discontinuity. They aren't necessarily the same thing, e.g., (x-a-1)/(x-2) $\endgroup$
    – Carl Woll
    Oct 25, 2018 at 22:44
  • $\begingroup$ Carl, thank you for pointing this out. Sorry if I was not clear enough. $\endgroup$ Oct 26, 2018 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.