You are on page 1of 10
TE 325 STOCHASTIC MODELING ‘Summer 2021 S. Dayanik Midterm Examination ‘Thursday, July 8 Instructions: The exam siarts at 18:00 and ends at 20.00 ¢ There are four questions. « It is closed book and closed notes. # Position your mirror so we can see your sereen from your camera. « Be seated uammted with camera on at all times, ¢ No head-phones are allowed, QUESTIONS 1. (25 pts) One dom. Then the host opens one of the other three doors behind which there isa goat. Afterwards, ar and three goats are hidden behind four doors. The guest piclss one door at ran- the guest picks at random one of the closed dooss different than s/he initially picked. What is the probability that the car is behind the door that the guest switched to? Was the switching of the doors a good idea? Solution. Let F be the event that the car is behind the door selected by the guest initially. Let S be event that the car is behind the door selected hy the gnest later. Then pir) = 4 and P(S|F)=0, pis|ry=4 ‘Therefore, P(S) =P(F)P(S| PF) + PUP) P(S | F) = + 0x2 Switching the doors was a good idea. 2. (25 pts) Below aro the railroad lines between cities A, B.C, and D: (p) ® @ © At the beginning of each d a itself everyday. Let Xq be the city that train reaches to at the end of the nth day: Suppose that ; a train picks at random one Tine going out of the city in which currently the train is a els to the next city by the end of the same day. The process repeats the train is initially in city A (a) What is the state space of X = (Xn)%o? Show that X is a Markov ehain, X is a Markov chain on {A, B,C, D} because train picks the next city to which it is going to travel from those directly accessible from the current city independently of all cities it visited in the past. So given the city currently the train is in, the cities to be visited in the future are conditionally independent of the cities visited in the past. ‘This is exactly the Markoy property, So X is a Markov chain. (wittatly Xe= A. The train may with Bem D uty protaltttcer 8.5 ond OS, repecthelg, on te nach dap. Became U= 039 <0.S, tats “sll gererate From B, cltly Ay Gren D are reachibe each uty tre same (12 greb ality, & 2 © Becaure Ur= FL YZ, Hes wil generate From D, cittes A omd B ave acecnble each with the some, grebabifity 0.5, Became Us = 0.93 505, Bite call goewate [X= B So. tre ctmntation s4 K fer terer eheps | daye predvad Kom A, X(= By Ko=D, X3=d, There are at art 410 wags h colic. tre prelluum Brest tg Let Up = expected number of vicity te oth D unl dy let viet fe city, c. Because Xoa hy and, tre day alter tue Hest visit te clsy C, MAO uM We tA chute By the answer Us 4, + Ug. Here, uw saticfrer tra equations To URE + (4g x uy) tL 4a = 5 Cua t ter 4) %. “cao pw FP Lt L Cuyeus) Substitute TE in L: UR aa (4s + ved (oars) t 3 J eof june SY ut qhat ys Zug 2 i+ du Zug = 4 to 4s uw. Up, = & a fe St 4s Suescitute Gh and TW fato I: Mo =f Le. et & Cuan] = 3 \ \ ait Lu AL sb ZUR t Foe S weigh eter stats 2 3 My Wah = ot ous = 2% 2+ Bau Wee Peet ge 68) @) Zune WF _& x * 3 3 we es = 2g bh Ae = gone MQ = SE y = 2G Thane fore Let us check the vale of Up ond Up Lettr Unser algebra, We treat state € as an absorltng stato. (f we delete the row and cofimn of P c3orverponding to chate C, we ebtuln ae BD Af o "2h B= sli ow OL to 4 e= (-a)'= b's ' “| -t : “Yo et ulare Gay is te expected tuber of witts to FT beGre absergiin inte Co starting from i for every iy @ LAD}, Hence, Yas Gy = 2E and ope egy ez, Lkteh are the came at bbe valaet Wt found by diceatty seritng and obving Linear recurnive equations (t,-8)'= The second be aug Weald be modify MC (ute anctuer one wit crates vanstien diagram EN) with 2x4 states Bee BiG, Dry Aa. 82, Cade, wore Co ts on dheabing cate. Pefire S = mia Lay Xn = er} and. find gos = & [ a “eave | X.= 4 Again. nara ara at Least tuo Lmys to solve tla problem. Eiece neg tet Vii = th pected number of tenes AD /DA Lie \e used given Kom, te k,a,cd S-4 = &[ Zi Coens nn tt Head tend) Ket We have vy = & Ct vp) + Fe l a, Vp = £ (tvs) eave Plug DW inte T, 1 { Ya dt [i+ £ Corva)s tve | +t NB fi t+ tv t 2% 3 +> Yo 4 q va I+ vg Smlctitbe fl and Ty. tuto fh; Ve, = fi z [vs + z (it va) ta val \ et vvat EN Second way, Let Ya he. the Chan ured in tre ate day Then Y= Cn)ite fe a MC on E= [hE AD, BA, Be. BD, CB, DAL DBT Untw eme-step Trantiiien prob matrx AB AD BA BC BD CB pA DB on Wn Ms 3 | sD We BA ala Ay P= ‘la Sa matos W= Bed Then Ge Want \ TA aB + Wad) , where - -@( 3 Liaato® [nei] ie k We can ertte ty dt Cf erence equations WW tue BSL bre Wee =0, Chudey condittou) = 1 WaBe S (sp, * Myc + Meo) Caen = tt £ (Moa + ~pp) { ZC eas + Was) L 3 Copa t petbe) = bag, eke, p= ova-ctep rans a pre. mat’x pe. Vert fp thst data ave correct entered To chock, tre rorst Cyn =3 obtnined with ta fit way) Tet us implamant tre recond nay unite computer, > Uibrary(Matrix) package allows us te construct SPARSE matrices > states <= c("AB", "AD", "BA", "BC*, "BD", "CB", "DAT, “0B") > P< sparsenatrix(t = eCren(1,2), ren(2, 2), ren(3.2), 4, qe rep(S, 2), repé, 3), rep(7,2), rep(8,3)),1 2S of all + i 8,'1:2, 6, : 5, a2, 3:5), Sete, Y pene + eCren(a/3,3), rep(1/2, 2), rep(a/2, 2), 1, fore : repti/2,2), repti/3, 3), Fepct/2, 2), rep(a/3, 3)),) values ) enbate + din = (8,8), dtmentton + dinnanes = Ust(fron = states, to = states)) ots and cedamn > names >P 8 x 8 sparse Matrix of class “dgCMatrix” to fron AB 6D oa 8 0 co DAB € : ao. 0,3233233 9,2333333 0.333383... Each det \s a acre, mo. : : 10.5 0.5 8A 0.5 0.5. : : a ac. : : alt ao. : : 20.5 0.5 cB... 0,3333333 0.3333333 0.3933333 .. DA 0.5 6.5 : + 0,3333333 9.333333 9,3333333 AB AD BA BC BD CB DA DB ddairiaqida > P %% sunmary() 8X 8 sparse Matrix of class “dgcMatrix", with 18 entries Verty that reu suns of © > P XX rowSuns() ] are all ene. ‘3 * 2 3.1 0.500000 2 7 1 0.5000008 3 3 2 0.5000000 47-2 0.5000088 5 13 0.333333 6 6 3 03333333 7 83 0.3333333 8 14 0.3333333 a 9 6 4 0.333333, HE 10 8 4 013333333 11-5 013333333 : 12.6 5 013333333 13 8 5 013333333 14 4.6 1.000002 : : 15 27 0.500080 1 Witte s arp 16 5 7 9.500008 gran, sarge 27 2.8 0.500000 : 28 5 8 0.5000008 : Eylt-grag, > P S=% image() = Synole > Q< PL-4, -4]1 Shote BC is abrorbing. Rameve >a 7X7 sparse Matrix of class “dgcatrix” to fron AB AD BA 80 CB DA be AB 0, 3333333 0.333333 : aD... + 0.5 6.5 BA 0.50.5 . : eo... : + 0.5 6.5 cB 0.333333 0.333333 DA 0.5 0.5. : see row end column for BC from P matrix te gt GQ motox DB 0.333333 0.333333 : > G < solve(Diagonal(7) - Q) %% Calenlete bre + set_colnames(colnames(Q)) %>% £ ral. mate'x + set_rownanes(rownanes(0)) £ > Lige between had 9 T MC OF >G Ds ated te either Terence 7 Initial (5 3.600800 osm -0n0002 ; les 0 1335338 Ye 11 ecce7 1666667 Cg = expected & weit can be 1.666667| 1.666667 | 2 1 /1.333333)1.333333 . 0 stat. ere KB on no |00 1 2. 0/1.666667/ 1.666567 bo state J Cw with Y_ 1 1 1)\1.080000| 1.080000 One par cular provaldairy, DA ¥.666667 |1.666667| 1 1 0/2.333333\1.333333 Ure) be fer 8 1 1 0\1.000200|2.080800 > Cfcc"aB", "AD"), c(*AD, "DA")] 2x 2 Matrix of class “dgeNatrix” Sum aL »D DA AB 1.008008 1.090960 and divide by ‘AD 2.333333 1.656567 > GLc("AB", "AD"), c("AD", [13 Abroretd on ts BC charbug fem it for Vax Bc dindl gy 2 (ent teat (tear (ned fe eit AB oe AD "DA")] 4% sum() %>% divide_by(2) Rorabh rr Te come of tw one. we found aging the Gilat way

You might also like