# Using Mathematica to derive the PDF of A Cos(x) [closed]

Let Y = cos(X), where X is uniformly distributed in the interval (0, 2 pi]. Find the pdf of Y.

I know the answer but want to verify using Mathematica.

-

## closed as off-topic by Daniel Lichtblau, MarcoB, Louis, blochwave, JensJan 26 at 5:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, Louis, blochwave, Jens
If this question can be reworded to fit the rules in the help center, please edit the question.

As PlatoManiac has shown TransformedDistribution you can also show noting: D[ArcCos[x],x] yields: $\frac{-1}{\sqrt{1-x^2}}$, then symmetry about $x=\pi$ yields : $2 \int_{\cos \pi}^{\cos 2\pi}\frac{1}{2\pi\sqrt{1-x^2}}\ dx= \int_{-1} ^{1}\frac{1}{\pi\sqrt{1-x^2}}\ dx$, hence PDF as per PlatoManiac. – ubpdqn Jan 23 at 11:50
Thanks for the answer. but i copied the code to the mathemetica notebook ( version 7 i use), showing syntax error. TransformedDistribution available in 7? – ppm Jan 23 at 13:08

The documentation on TransformedDistribution will guide you through.

d = TransformedDistribution[Cos[x], x \[Distributed] UniformDistribution[{0, 2 Pi}]];
pdf = PDF[d, x]


Output will be this $$\begin{array}{cc} f_y(x)=\{ & \begin{array}{cc} \text{Indeterminate} & x=-1\lor x=1 \\ \frac{1}{\pi \sqrt{1-x^2}} & -1<x<1 \\ \end{array} \\ \end{array}$$

You can plot the pdf.

Plot[Evaluate[pdf], {x, -1, 1}, Filling -> Axis]


-
Thanks for the answer. but i copied the code to the mathemetica notebook ( version 7 i use), showing syntax error. TransformedDistribution available in 7? – ppm Jan 23 at 12:55
No, TransformedDistribution was introduced in version 8. This information is noted at the bottom of the online reference page. – Sasha Jan 23 at 13:38