Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a function like this

$f(x,y)=c\,y\,(y-x),\ \text{for}\ 0<x<2,\;-x<y<x$

and I need to find the value of $c$ such that $f(x,y)$ is a PDF.

How can I do that?

I know that the condition is double integral $f(x,y)=1$, but how can I impose that condition with Mathematica?

share|improve this question
    
Hello xmpirate! It is not clear that your question is about using the Mathematica software. Please indicate what you have tried, including any code that is not working for you. Belisarius has given an example in his answer, but perhaps your question is about something else. It is not very clear. –  Verbeia Oct 3 '13 at 2:27
add comment

4 Answers 4

up vote 3 down vote accepted

You forgot the prior condition that the density must not be negative.
There are two solutions, depending on the sign of c.

If c is positive then Reduce[y(y-x) >= 0 && 0 < x < 2 && -x < y < x, {x,y}]

0 < x < 2 && -x < y < 0

gives the region over which f is non-negative, and c = 1/Integrate[y(y-x), {x,0,2}, {y,-x,0}]

3/10

If c is negative then Reduce[y(y-x) <= 0 && 0 < x < 2 && -x < y < x, {x,y}]

0 < x < 2 && 0 < y < x

gives the region over which f is non-negative, and c = 1/Integrate[y(y-x), {x,0,2}, {y,0,x}]

-3/2

share|improve this answer
add comment
s = Solve[Integrate[c y (y - x), {x, 0, 2}, {y, -x, x}] == 1]

Plot3D[c y (y - x) /. s[[1]], {x, 0, 2}, {y, -x, x}, PlotRange -> All, Mesh -> None, 
       PlotStyle -> Directive[Orange, Specularity[White, 40]], Filling -> Bottom]

(* {{c -> 3/8}} *)

Mathematica graphics

share|improve this answer
    
what is the range of y. –  xmpirate Oct 3 '13 at 1:44
add comment

The double integral gives a very simple value in terms of $c$

Integrate[c y (y - x), {x, 0, 2}, {y, -x, x}]
8 c/3

so the equation to be solved is a trivial one

8 c/3 == 1

that we can solve in our heads to get $c=\frac{3}{8}$.

share|improve this answer
add comment

Or just:

1/Integrate[y (y - x), {x, 0, 2}, {y, -x, x}]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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