Description
Exercise 1.
A random variable X has CDF:
FX(x) = (
0, if x < 0,
1 −
1
4
e
−2x
, if x ≥ 0.
(a) Find P[X ≤ 3], P[X = 0], P[X < 0], P[4 < X < 7] and P[X > 8].
(b) Find fX(x).
c 2020 Stanley Chan. All Rights Reserved. 1
Exercise 2.
A continuous random variable X has a cumulative distribution
FX(x) =
0, x < 0,
0.5 + c cos2
(πx/2 + θ), 0 ≤ x < 1,
1, x ≥ 1.
(a) Find the minimum θ, assuming 0 ≤ θ ≤ 2π.
(b) Based on your result in (a), find c.
(c) Find fX(x).
c 2020 Stanley Chan. All Rights Reserved. 2
Exercise 3.
Let X be a Gaussian random variable with µ = 5, σ
2 = 16.
(a) P[X > 3], P[2 ≤ X ≤ 6].
(b) If P[X < a] = 0.7910, find a.
(c) If P[X > b] = 0.1635, find b.
(d) If P[13 < X ≤ c] = 0.0011, find c.
c 2020 Stanley Chan. All Rights Reserved. 3
Exercise 4.
Compute E[Y ] and E[Y
2
] for the following random variables:
(a) Y = A sin(ωt + θ), where A ∼ N (µ, σ2
).
(b) Y = a sin(ωt + Θ), where Θ ∼ Uniform(0, π).
(c) Y = a sin(ωT + θ), where T ∼ Uniform
−
π
2ω
,
π
2ω
.
c 2020 Stanley Chan. All Rights Reserved.
Exercise 5.
A continuous random variable X is uniformly distributed in [−2, 2].
(a) Let Y = sin(πX/8). Find fY (y).
(b) Let Z = 2X2 + 1. Find fZ(z).
Hint: Compute FY (y) from FX(x), and use d
dy sin−1
y = √
1
1−y2
.
c 2020 Stanley Chan. All Rights Reserved. 5
Exercise 6.
A few days ago my daughter’s piano teacher asked me to scan a music sheet for my daughter. I have a
IPEVO document camera, which is not the best in the market but quite descent at the $100-$200 range.
I took a picture, and adjusted the lighting as much as I could. Here is the picture. The background is
gray-ish, and the color did not look good. FYI, you can read an image and display in MATLAB by using
these commands. (For Python, you can do cv2.imread, cv2.cvtColor and cv2.imshow.)
x = im2double(imread(’some_file_name.png’));
x = rgb2gray(x);
imshow(x);
(a) Raw input (b) Binary quantization (c) What I want
Figure 1: (a) Raw input of a photo-scan of a document. The goal of this exercise is to design a nonlinear
transformation that can correct the color of the document. (b) A simple binary thresholding. (c) The desired
output. You are welcome to do something better than mine.
I was not happy about the undesired color of the raw image. So I tried some simple tricks. The thing I did
was to convert the image into binary color. This is done using a simple command
x(x>0.5) = 1;
x(x<0.5) = 0;
Now, the image looks much better as you can see in part (b) of the figure. So I brought this to my wife. And
she complained. She said the hand written notes are gone, and some music notes are not clear. So I looked
at the histogram of the data. It appeared to me that the histogram has a bi-modal distribution which is
expected because there is foreground text and background color. The problem is that the two distributions
are too close to each other. One way to address this is to come up with a nonlinear transformation g(·) such
that
Y = g(X) (1)
has the desired histogram, where X is the original random variable and Y is the transformed random variable.
Here is your exercise. I want you to come up with a nonlinear transformation g(·). For example, you can
try:
• Quadratic equation, but I do not think this will work. g(X) = X2
. In MATLAB, this would be
y = x.^2, where x is the input image.
c 2020 Stanley Chan. All Rights Reserved. 6
0 0.2 0.4 0.6 0.8
0
0.5
1
1.5
2
105
(a) Original histogram (b) Transformation of random variables
• Piecewise linear transformation, which you need to figure out all these parameters.
g(X) =
a1X + b1, `1 ≤ X ≤ u1
a2X + b2, `2 ≤ X ≤ u2
a3X + b3, `3 ≤ X ≤ u3
• Exponential function, which I have not tried, g(X) = e
X. (Or some variants of that.)
• Logarithmic function, which I also have not tried, g(X) = log X. (Or some variants of that.)
• Your creative solution!
For this exercise, please just submit: (1) Your nonlinear transformation, basically the equation g(X). (2)
Your histograms, before and after. (3) Your final output image.
Please do not use photoshop or any off-the-shelf commercial software because this will defeat the educational
purpose of this exercise. You can also search on Wikipedia. A few ideas that were relevant are: (a) Balanced
histogram thresholding. This idea does not really work for us because it outputs a binary image. I want a
gray-scale image, and I want to preserve the hand written note as much as I can. (b) Histogram equalization.
I tried this, but it did not work. You can try it too. The bottom line is that you can try whatever you
want, but I am only looking for a very simple transformation g(X). It should be one single equation. As a
reference, the solution I came up with is just a single line of MATLAB code.
Please write your transformation here
g(X) =
Please attached your histograms and the final image after this page. No need to submit your code.
c 2020 Stanley Chan. All Rights Reserved. 7