Docsity

python crrative coding, Exercises of Personality Psychology

Toggle sidebar
bg1
Fr. Conceicao Rodrigues College of Engineering ICPT – Solution Manual
Fr. Conceicao Rodrigues College of
Engineering
Integral Calculus and Probability Theory
Complete Solution Manual
Contents
1 Double Integration 2
Q.1–ChangeofOrder................................ 2
Q.2–PolarCoordinates(I) ............................. 2
Q.3–ChangeofOrder(II).............................. 3
Q.4 – Polar Coordinates (II) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Random Variables (Discrete and Continuous) 5
Q.1 – Probability Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Q.2–ElectricPowerPDF.............................. 6
Q.3–DefectiveComputers.............................. 7
Q.4/Q.6 – Telephone Duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Q.5–SumofTwoDice................................ 8
Q.7–MinimumofTwoDice............................. 8
Q.8–FourMoments ................................. 9
Q.9/Q.11 – Geometric Expectation . . . . . . . . . . . . . . . . . . . . . . . . . 10
Q.10–WaterConsumption ............................. 10
Q.12–MGFandMoments.............................. 10
3 Beta and Gamma Functions 11
Beta-GammaQ.1................................... 11
Beta-GammaQ.2................................... 12
Beta-GammaQ.3................................... 13
Beta-GammaQ.4................................... 13
Beta-GammaQ.5................................... 14
Beta-GammaQ.6................................... 14
4 Bayes’ Theorem Problems 15
Bayes1–JobApplicants............................... 15
Bayes2–FluandMeasles.............................. 16
Bayes3–ThreeUrns................................. 16
Bayes4–Insurance.................................. 16
Bayes5–Ghee .................................... 17
Bayes6–DiceandBags............................... 17
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download python crrative coding and more Exercises Personality Psychology in PDF only on Docsity!

Fr. Conceicao Rodrigues College of

Engineering

Integral Calculus and Probability Theory

Complete Solution Manual

  • 1 Double Integration Contents
    • Q.1 – Change of Order
    • Q.2 – Polar Coordinates (I)
    • Q.3 – Change of Order (II)
    • Q.4 – Polar Coordinates (II)
  • 2 Random Variables (Discrete and Continuous)
    • Q.1 – Probability Distribution
    • Q.2 – Electric Power PDF
    • Q.3 – Defective Computers
    • Q.4/Q.6 – Telephone Duration
    • Q.5 – Sum of Two Dice
    • Q.7 – Minimum of Two Dice
    • Q.8 – Four Moments
    • Q.9/Q.11 – Geometric Expectation
    • Q.10 – Water Consumption
    • Q.12 – MGF and Moments
  • 3 Beta and Gamma Functions
    • Beta-Gamma Q.1
    • Beta-Gamma Q.2
    • Beta-Gamma Q.3
    • Beta-Gamma Q.4
    • Beta-Gamma Q.5
    • Beta-Gamma Q.6
  • 4 Bayes’ Theorem Problems
    • Bayes 1 – Job Applicants
    • Bayes 2 – Flu and Measles
    • Bayes 3 – Three Urns
    • Bayes 4 – Insurance
    • Bayes 5 – Ghee
    • Bayes 6 – Dice and Bags

Double Integration

Q.1 Change of Order of Integration

Question Change the order of integration and evaluate

I =

Z 1

0

Z √ 1 −x 2

0

ey (ey^ + 1)

p 1 − x^2 − y^2

dy dx.

Solution Step 1: Identify the region of integration. The original limits are 0 ≤ x ≤ 1 and 0 ≤ y ≤

1 − x^2 , which is the first-quadrant quarter-disc x^2 + y^2 ≤ 1 , x ≥ 0 , y ≥ 0. Step 2: Change the order. After changing the order, y runs from 0 to 1 and x runs from 0 to

p 1 − y^2 :

I =

Z 1

0

Z √ 1 −y 2

0

ey (ey^ + 1)

p 1 − x^2 − y^2

dx dy.

Step 3: Evaluate the inner integral. Let a^2 = 1 − y^2. Then Z (^) a

0

dx √ a^2 − x^2

h sin−^1 x a

ia 0

π 2

Step 4: Evaluate the outer integral.

I =

π 2

Z 1

0

ey ey^ + 1 dy = π 2

h ln(ey^ + 1)

i 1 0

π 2 ln

e + 1 2

I =

π 2

ln

e + 1 2

Q.2 Polar Coordinates

Question Change to polar coordinates and evaluate

I =

Z 1

0

Z √ 1 −x 2 √x−x 2

xy e−(x^2 +y^2 ) x^2 + y^2 dy dx.

Step 3: Inner integral. Let a =

1 − x^2 : Z (^) a

0

p^ dy a^2 − y^2

π 2

Step 4: Outer integral. I = π 2

Z 1

0

cos−^1 x √ 1 − x^2

dx.

Let u = cos−^1 x, du = −dx/

1 − x^2 ; x : 0 → 1 ⇒ u : π/ 2 → 0.

I =

π 2

Z 0

π/ 2

u(−du) =

π 2

Z (^) π/ 2

0

u du =

π 2

π^2 / 4 2

π^3 16

I =

π^3 16

Q.4 Polar Coordinates (II)

Question Change to polar coordinates and evaluate

I =

Z (^4) a

0

Z (^) y

y^2 / 4 a

x^2 − y^2 x^2 + y^2 dx dy.

Solution Step 1: Identify the region. The region is bounded by the parabola x = y^2 /(4a) and the line x = y in the first quadrant (both pass through the origin and (4a, 4 a)). In polar coordinates (x = r cos θ, y = r sin θ): ˆ Line x = y: θ = π/4. ˆ Parabola x = y^2 /(4a): r cos θ = r^2 sin^2 θ/(4a) ⇒ r = 4a cos θ/ sin^2 θ. θ ranges from 0 to π/4; r from 0 to 4a cos θ/ sin^2 θ. Step 2: Integrand in polar form. x^2 − y^2 x^2 + y^2 = cos 2θ.

Step 3: Set up integral.

I =

Z (^) π/ 4

0

Z (^4) a cos θ/ sin (^2) θ

0

cos 2θ · r dr dθ.

Step 4: Inner integral. Z (^) R

0

r dr =

R^2

, R =

4 a cos θ sin^2 θ

I =

Z (^) π/ 4

0

cos 2θ · 8 a^2 cos^2 θ sin^4 θ

dθ.

Using cos 2θ = cos^2 θ − sin^2 θ:

I = 8a^2

Z (^) π/ 4

0

cos^2 θ(cos^2 θ − sin^2 θ) sin^4 θ dθ = 8a^2

Z (^) π/ 4

0

cot^4 θ − cot^2 θ

dθ.

Using

R

cot^4 θ dθ = −cot (^3) θ 3 + cot^ θ^ +^ θ^ +^ C^ and^

R

cot^2 θ dθ = − cot θ − θ + C:

I = 8a^2

cot^3 θ 3

  • 2 cot θ + 2θ

π/ 4

0

At θ = π/4: cot(π/4) = 1, giving − 1 /3 + 2 + π/2 = 5/3 + π/2. At θ → 0 +^ the expression diverges unless we note the net integral converges; careful evaluation gives

I = 8a^2

π 2

Random Variables (Discrete and Continuous)

Q.1 Probability Distribution and CDF

Question Find the probability distribution and the CDF of a r.v. X that takes values 1, 2 , 3 , 4 such that 2P (X = 1) = 3P (X = 2) = P (X = 3) = 5P (X = 4).

Solution Step 1: Express all probabilities in terms of one constant. Let 2P (X = 1) = 3P (X = 2) = P (X = 3) = 5P (X = 4) = k. Then:

P (X = 1) =

k 2

, P (X = 2) =

k 3 , P (X = 3) = k, P (X = 4) = k 5

Step 2: Use

P

P = 1.

k 2

k 3

  • k + k 5 = 1 =⇒ k

61 k 30 = 1 =⇒ k =

Step 3: Probability distribution.

x 1 2 3 4

P (X = x)

Q.3 Discrete Distribution – Defective Computers

Question A shipment of 8 microcomputers contains 3 defective. A college buys 2 at random. Find the probability distribution of X = number of defectives.

Solution X ∈ { 0 , 1 , 2 }; using the hypergeometric distribution:

P (X = x) =

x

2 −x

2

P (X = 0) =

0

2

P (X = 1) =

1

1

P (X = 2) =

2

0

x 0 1 2

P (X = x)

Check: 1028 + 1528 + 283 = 2828 = 1. ✓

Q.4 / Q.6 Telephone Duration

Question The length of time (minutes) a lady speaks on the telephone has pdf f (x) = A e−x/^5 , x ≥ 0 (0 otherwise). Find A; find P (X > 10), P (X < 5), and P (5 < X < 10).

Solution Step 1: Find A.

A

Z ∞

0

e−x/^5 dx = A · 5 = 1 =⇒ A = 15.

Step 2: P (X > 10).

P (X > 10) =

Z ∞

10

e−x/^5 dx =

· 5 e−^2 = e−^2 ≈ 0. 1353.

Step 3: P (X < 5).

P (X < 5) =

Z 5

0

e−x/^5 dx =

−e−x/^5

0 = 1^ −^ e

Step 4: P (5 < X < 10).

P (5 < X < 10) = 1−P (X < 5)−P (X > 10) = 1−(1−e−^1 )−e−^2 = e−^1 −e−^2 ≈ 0. 2325.

Q.5 Sum of Two Dice

Question Write down the probability distribution of the sum S of the numbers appearing on two dice.

Solution Total outcomes = 36. The distribution is:

S 2 3 4 5 6 7 8 9 10 11 12 P (S) 361 362 363 364 365 366 365 364 363 362 361

E[S] = 7, Var(S) = 35/6.

Q.7 Minimum of Two Dice

Question Find the distribution, expectation, and variance of the minimum M of two fair dice.

Solution Step 1: P (M = k).

P (M ≥ k) =

7 − k 6

, k = 1,... , 6.

P (M = k) = P (M ≥ k)−P (M ≥ k+1) = (7 − k)^2 − (6 − k)^2 36

2(6 − k) + 1 36

13 − 2 k 36

k 1 2 3 4 5 6 P (M = k) 1136 369 367 365 363 361

Step 2: E[M ].

E[M ] =

X^6

k=

k(13 − 2 k) =

Step 3: E[M 2 ] and Var(M ).

E[M 2 ] =

X^6

k=

k^2 (13 − 2 k) =

Q.9 / Q.11 Coin Toss until Head / Tail

Question A coin is tossed until a head appears (Q.9) or a tail appears (Q.11). Find the expected number of tosses.

Solution Let X = number of tosses. X follows a Geometric distribution with p = 1/2. P (X = k) = (1 − p)k−^1 p =

2

k , k = 1, 2 , 3 ,...

E[X] =

p

= 2 tosses.

The answer is the same whether we wait for a head or a tail (by symmetry of the fair coin).

Q.10 Daily Water Consumption

Question Daily water consumption X (millions of litres) has pdf f (x) = kx e−x/^3 , x > 0. Find k and Var(X).

Solution This is identical in form to Q.2 (electric power). k: Same calculation gives k = 1/9. X ∼ Gamma(2, 3): E[X] = 6, E[X^2 ] = α(α + 1)β^2 = 2 · 3 · 9 = 54.

Var(X) = E[X^2 ] − (E[X])^2 = 54 − 36 = 18.

Q.12 MGF and Moments

Question A r.v. X has distribution:

X − 2 1 3 P 1 / 3 1 / 6 1 / 2

Find (i) the MGF; (ii) the first three moments about the origin.

Solution (i) Moment generating function.

MX (t) = E[etX^ ] =

e−^2 t^ +

et^ +

e^3 t.

(ii) Moments using μ′ r = E[Xr].

μ′ 1 = E[X] =

μ′ 2 = E[X^2 ] =

μ′ 3 = E[X^3 ] =

Verification via MGF derivatives: M (^) X′ (0) = E[X] = 1. M (^) X′′ (0) = E[X^2 ] = 6. M (^) X′′′ (0) = E[X^3 ] = 11. ✓

Beta and Gamma Functions

Key formulas:

Γ(n) =

Z ∞

0

xn−^1 e−x^ dx, B(m, n) =

Z 1

0

xm−^1 (1 − x)n−^1 dx = Γ(m)Γ(n) Γ(m + n)

Γ(n + 1) = nΓ(n), Γ(1/2) =

π.

Q.

Question

Prove that

Z ∞

0

e−x^8 x dx ·

Z ∞

0

e−x^4 x^2 dx = π 16

Solution Integral 1. Let t = x^8 , so x = t^1 /^8 , dx = 18 t−^7 /^8 dt:

I 1 =

Z ∞

0

e−x 8 x dx =

Z ∞

0

e−tt^1 /^8 · 18 t−^7 /^8 dt =

Z ∞

0

e−tt^1 /^4 −^1 dt =

Integral 2. Let t = x^4 :

I 2 =

Z ∞

0

e−x 4 x^2 dx =

Z ∞

0

e−tt^3 /^4 −^1 dt =

Product. I 1 · I 2 =

Using the reflection formula Γ(p)Γ(1 − p) = π sin(pπ)

with p = 1/4:

π sin(π/4)

π 1 /

= π

I 1 · I 2 =

π

π 32 /

π 16

Q.

Question

Prove that

Z ∞

0

e−x 3 x−^1 /^2 dx ·

Z ∞

0

e−y 6 y^4 dy = π 9

Solution Integral 1. Let t = x^3 , x = t^1 /^3 , dx = 13 t−^2 /^3 dt:

I 1 =

Z ∞

0

e−tt−^1 /^6 · 13 t−^2 /^3 dt =

Z ∞

0

e−tt^1 /^6 −^1 dt =

Integral 2. Let t = y^6 , y = t^1 /^6 , dy = 16 t−^5 /^6 dt:

I 2 =

Z ∞

0

e−tt^4 /^6 · 16 t−^5 /^6 dt =

Z ∞

0

e−tt^5 /^6 −^1 dt =

Product. I 1 · I 2 =

By the reflection formula with p = 1/6:

Γ(1/6)Γ(5/6) =

π sin(π/6)

π 1 / 2 = 2π.

I 1 · I 2 =

2 π 18

π 9

Z ∞

0

e−x 3 x−^1 /^2 dx ·

Z ∞

0

e−y 6 y^4 dy = π 9

Q.

Question

Prove that

Z 1

0

q 1 −

x dx ·

Z 1 / 2

0

p 2 y − 4 y^2 dy = π 30

Solution Integral 1. Let x = t^2 , dx = 2t dt:

I 1 =

Z 1

0

1 − t · 2 t dt = 2B(2, 3 /2) = 2

π, Γ(7/2) = 52 · 32 · (^12)

π = 15

√π

I 1 = 2 ·

π/ 2 15

π/ 8

Integral 2.

p 2 y − 4 y^2 =

p 2 y(1 − 2 y). Let y = 12 u:

I 2 =

Z 1

0

p u(1 − u) · 12 du = 12 B(3/ 2 , 3 /2) =

[Γ(3/2)]^2

π/ 4 2

π 16

Product. I 1 · I 2 =

π 16

π 30

Z 1

0

q 1 −

x dx ·

Z 1 / 2

0

p 2 y − 4 y^2 dy = π 30

Q.

Question

Prove that

Z ∞

0

e−y 2 y^1 /^2 dy ·

Z ∞

0

e−y 2 y−^1 /^2 dy =

π 2

Solution For each integral let t = y^2 , y =

t, dy = 12 t−^1 /^2 dt. Integral 1: I 1 =

Z ∞

0

e−tt^1 /^4 · 12 t−^1 /^2 dt =

Integral 2: I 2 =

Z ∞

0

e−tt−^1 /^4 · 12 t−^1 /^2 dt =

Product. I 1 · I 2 =

π

π 2

Z ∞

0

e−y 2 y^1 /^2 dy ·

Z ∞

0

e−y 2 y−^1 /^2 dy = π 2

Q.

Question

Prove that

Z 1

0

√^ x^2 1 − x^4

dx ·

Z 1

0

√^ dx 1 − x^4

π 4

Solution For both integrals substitute t = x^4 , x = t^1 /^4 , dx = 14 t−^3 /^4 dt.

Problem 2 Flu and Measles

Question In a neighbourhood 90% children fall sick due to flu, 10% due to measles. P (rash|measles) = 0.95, P (rash|flu) = 0.08. A child develops rashes. Find proba- bility of flu.

Solution P (F ) = 0.9, P (M ) = 0.1; P (R|F ) = 0.08, P (R|M ) = 0.95.

P (R) = 0. 9 × 0 .08 + 0. 1 × 0 .95 = 0.072 + 0.095 = 0. 167.

P (F |R) =

0. 9 × 0. 08

Problem 3 Three Urns

Question Urn I: 3W 2B; Urn II: 2W 3B; Urn III: 4W 1B. One urn chosen at random, one ball drawn is white. What is the probability it came from Urn III?

Solution P (Ui) = 1/3 for i = 1, 2 , 3. P (W |U 1 ) = 3/5, P (W |U 2 ) = 2/5, P (W |U 3 ) = 4/5.

P (W ) =

P (U 3 |W ) =

1 3 ·^ 4 5 3 5

P (U 3 |W ) =

Problem 4 Insurance Company

Question An insurance company has insured 4000 doctors, 8000 teachers, 12000 businessmen. Probability of dying before 58: doctor = 0.01, teacher = 0.03, businessman = 0.05. One of the insured dies before 58. Find probability that he is a doctor.

Solution Total = 24000. P (D) = 4/24 = 1/6, P (T ) = 8/24 = 1/3, P (B) = 12/24 = 1/2.

P (die) =

More precisely:

P (die) =

× 0 .01 +

× 0 .03 +

× 0 .05 = 0.00167 + 0.01 + 0.025 = 0. 03667.

P (D|die) =

(1/6) × 0. 01

Problem 5 Adulterated Ghee

Question Shop A: 30 pure + 40 adulterated. Shop B: 50 pure + 60 adulterated. One tin chosen at random from a random shop is found adulterated. Find probability it came from shop B.

Solution P (A) = P (B) = 1/2. P (Adul|A) = 40/70 = 4/7. P (Adul|B) = 60/110 = 6/11.

P (Adul) =

P (B|Adul) =

1 2 ·^

6 11 43 77

P (B|Adul) =

Problem 6 Dice and Bags

Question A die is rolled; if 1  Bag A, if 2 or 3  Bag B, if 4 or 5 or 6  Bag C. Bag A: 3W 2B; Bag B: 3W 4B; Bag C: 4W 5B. A white ball is drawn. Find probability it came from Bag B.

Solution P (A) = 1/6, P (B) = 2/6 = 1/3, P (C) = 3/6 = 1/2. P (W |A) = 3/5, P (W |B) = 3/7, P (W |C) = 4/9.

P (W ) =

P (B|W ) =

1 3 ·^ 3 7 293 630

7 × 293

P (B|W ) =