After a long time without having touch anything related to maths or statistics, I decided to give myself another chance. I am currently refreshing some concepts of density and distribution functions, and I'm now facing a little misconception. Briefly, I have this density function:

\begin{cases} 0 & \text x < 0\\ 2x/(1+x^2 )^2 & \text{x ≥ 0} \end{cases}

from which I have obtained the following distribution function after calculating the integrate:

\begin{cases} 0 & \text x < 0\\ -1/(1+x)^2 & \text{x ≥ 0} \end{cases}

My problem is that I'm trying to plot the distribution function using R, but since the distribution function is negative, I'm not sure if it is correct (shouldn´t it be positive?) and which would be the best way to plot it (of course, I'm a R newby too).

Thank you in advance.

  • 1
    $\begingroup$ You quote the indefinite integral, which is defined only up to an additive constant. For the definite integral you are trying to obtain, choose that constant appropriately. $\endgroup$
    – whuber
    Commented Mar 31, 2019 at 16:21

1 Answer 1


You've a typo in the denominator of your distribution function: $x$ should be $x^2$, w/o the square of the parentheses. And, as @whuber said, you need a constant term after the integration (for $x\geq 0$):

$$F(x)=\int \frac{2xdx}{(1+x^2)^2}=-\frac{1}{1+x^2}+C$$

By definition, $\lim_{x\rightarrow \infty}F(x)=1$, substituting yields $$\lim_{x\rightarrow\infty}F(x)=C-\lim_{x\rightarrow\infty}\frac{1}{1+x^2}=C=1$$

So, you can plot the following, for $x\geq 0$, (for $x<0$, $F(x)=0$): $$F(x)=1-\frac{1}{1+x^2}=\frac{x^2}{1+x^2}$$

  • $\begingroup$ Thank you gunes, this helps a lot. But I have a (naive, maybe) question. The distribution function, isn´t it supposed to be the cumulative of the density function? I mean, for the density function, f(1)+f(2)=0.66, but for the distribution, according to your F(x), then F(2)=0.8. Shouldn´t these values be the same? $\endgroup$
    – Voronin_10
    Commented Mar 31, 2019 at 18:14
  • 1
    $\begingroup$ Yes, $F(x)$ is CDF and is actually defined as $P(X\leq x)=\int_{-\infty}^x f(x)$. You cannot sum individual $f$'s because $x$ is continuous. What about $f(1.5),f(1.55),f(1.553),...$, $\endgroup$
    – gunes
    Commented Mar 31, 2019 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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