ITPEC FE Subject B October 2024 Question 15

Source exam: ITPEC FE Subject B October 2024Topic: Math & Numbers

ITPEC FE Subject B October 2024 — Question 15 of 20

Matrix Exponentiation (Markov Chain) — multiply a transition matrix to find state probabilities after multiple steps.

The program computes P³ (transition matrix raised to the 3rd power) to predict weather probabilities 3 days ahead.

Blank A — loop count:
- dmat starts as pmat (= P¹)

- Each iteration multiplies dmat × pmat, so after n iterations: dmat = P^(n+1)

- To get P³, we need 2 iterations → m from 1 to 2A = 2

Blank B — matrix multiplication formula:
- Standard: C[i,j] = Σ(k) A[i,k] × B[k,j]

- Here: smat[i,j] += dmat[i, k] × pmat[k, j]

Answer: (a) — A = 2, B = dmat[i, k] × pmat[k, j]

Why not others:
- (b) — wrong index order (dmat[k,i] × pmat[j,k]), not valid matrix multiplication

- (c) — A=3 would give P⁴, not P³

- (d) — A=3 with wrong index order

- (e) — A=4 would give P⁵

- (f) — A=4 with wrong index order

Key rule: for matrix multiplication C = A × B, always use C[i,j] += A[i,k] × B[k,j] — the shared index k is the inner dimension.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.