Docsity

LING 570: Homework 2 - Probability Theory and Formal Languages - Prof. Fei Xia, Assignments of Linguistics

Toggle sidebar
bg1
LING 570: Hw2
Due date: 3pm on Oct 10
This assignment does not require any programming, so the submission only needs to
include a note file hw2.*, which provides your answers to the questions.
Part I (35 points): Elementary probability theory
(1) (10 points) (from M&S Page 59, Exercise 2.4):
Are X and Y as defined in the following table independently distributed?
Explain your answer.
x 0 0 1 1
y 0 1 0 1
P(x,y) 0.32 0.08 0.48 0.12
(2) (25 points) There are three coins: c1, c2, and c3. When tossing the coins once, the
probabilities of getting a head are 0.1, 0.4, and 0.7, respectively. Now assume that
you pick one of the coins with the probability 0.2 of being c1, 0.5 of being c2, 0.3
of being c3.
a. (5 points) If you toss the coin once, what is the probability of getting a
head?
b. (5 points) If you toss the coin once and get a head, what is the probability
that c1 was picked for this toss?
c. (5 points) If you toss the same coin twice, what is the probability of
getting two heads?
d. (5 points) If you toss the same coin twice and get two heads, what is the
probability that c1 was picked for the tosses?
e. (5 points) If you toss the same coin twice and get two heads, which coin
was most likely to be the one that was picked for the tosses? Explain your
answer.
Part II (30 points): Formal grammars and formal languages
(1) (5 points) Write a right regular grammar for the language {a*b*}.
(2) (5 points) Write a context-free grammar for the language {a^n b^n}.
(3) (5 points) Write a context-free grammar for the language {x y | x is a string over
{a,b,c}, y is a reverse of x}.
(4) (15 points) Write a context-free grammar for the language consisting of all strings
over {a,b} for which the number of a's is more than the number of b's.
Part III (35 points): J&M Chapter 2, Page 28: Exercise 2.1.

Partial preview of the text

Download LING 570: Homework 2 - Probability Theory and Formal Languages - Prof. Fei Xia and more Assignments Linguistics in PDF only on Docsity!

LING 570: Hw Due date: 3pm on Oct 10 This assignment does not require any programming, so the submission only needs to include a note file hw2., which provides your answers to the questions. Part I (35 points) : Elementary probability theory (1) (10 points) (from M&S Page 59, Exercise 2.4): Are X and Y as defined in the following table independently distributed? Explain your answer. x 0 0 1 1 y 0 1 0 1 P(x,y) 0.32 0.08 0.48 0. (2) (25 points) There are three coins: c1, c2, and c3. When tossing the coins once, the probabilities of getting a head are 0.1, 0.4, and 0.7, respectively. Now assume that you pick one of the coins with the probability 0.2 of being c1, 0.5 of being c2, 0. of being c3. a. (5 points) If you toss the coin once, what is the probability of getting a head? b. (5 points) If you toss the coin once and get a head, what is the probability that c1 was picked for this toss? c. (5 points) If you toss the same coin twice, what is the probability of getting two heads? d. (5 points) If you toss the same coin twice and get two heads, what is the probability that c1 was picked for the tosses? e. (5 points) If you toss the same coin twice and get two heads, which coin was most likely to be the one that was picked for the tosses? Explain your answer. Part II (30 points): Formal grammars and formal languages (1) (5 points) Write a right regular grammar for the language {ab*}. (2) (5 points) Write a context-free grammar for the language {a^n b^n}. (3) (5 points) Write a context-free grammar for the language {x y | x is a string over {a,b,c}, y is a reverse of x}. (4) (15 points) Write a context-free grammar for the language consisting of all strings over {a,b} for which the number of a's is more than the number of b's. Part III (35 points): J&M Chapter 2, Page 28: Exercise 2.1.