FAD1015: MATHEMATICS III — Exam Focus: Leak Topics
Based on LEAK/EXAM TIPS. Lecturer solved in ~35 minutes. All four topics below are likely Section B (longer, higher-weight questions).
| # | Topic | Type | Weight |
|---|---|---|---|
| 1 | R Language — Matrix Operations | Section B | Heavy |
| 2 | R Language — Descriptive Stats Output | Section B | Moderate |
| 3 | Permutation & Counting | Section B | Heavy |
| 4 | Hypothesis Testing | Section B | Heavy |
Quick Navigation
- R Matrix Operations
- R Descriptive Stats Output
- Permutation & Counting
- Hypothesis Testing
- Quick-Reference Tables
- Revision Checklists
1. R Language — Matrix Operations (Section B)
1.1 Creating Matrices
matrix() — By Column (Default)
# 3x3 matrix filled column-wise by default
A <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), nrow = 3, ncol = 3)
# [,1] [,2] [,3]
# [1,] 1 4 7
# [2,] 2 5 8
# [3,] 3 6 9
# Fill row-wise instead
B <- matrix(1:9, nrow = 3, byrow = TRUE)
# [,1] [,2] [,3]
# [1,] 1 2 3
# [2,] 4 5 6
# [3,] 7 8 9
Exam trap: Remember
matrix()fills by column by default! Usebyrow = TRUEfor row-wise fill.
rbind() — Bind Rows
row1 <- c(1, 2, 3)
row2 <- c(4, 5, 6)
row3 <- c(7, 8, 9)
M <- rbind(row1, row2, row3)
cbind() — Bind Columns
col1 <- c(1, 4, 7)
col2 <- c(2, 5, 8)
col3 <- c(3, 6, 9)
M <- cbind(col1, col2, col3)
1.2 Naming Rows and Columns
A <- matrix(1:9, nrow = 3)
rownames(A) <- c("Row1", "Row2", "Row3")
colnames(A) <- c("Col1", "Col2", "Col3")
1.3 Subsetting Matrices
A[i, j] # Element at row i, column j
A[i, ] # Entire row i
A[, j] # Entire column j
A[1:2, ] # First two rows
A[, -2] # All columns except column 2
A[c(1,3), c(2,3)] # Rows 1 & 3, columns 2 & 3
Warning: Subsetting a single column/row may return a vector (not a matrix). Use
drop = FALSEto preserve matrix structure:A[, 1, drop = FALSE] # Returns a 3x1 matrix, not a vector
1.4 Matrix Operations
| Operation | R Syntax | Notes |
|---|---|---|
| Addition | A + B |
Element-wise, same dimensions |
| Subtraction | A - B |
Element-wise |
| Scalar multiplication | 2 * A |
Multiplies every element |
| Matrix multiplication | A %*% B |
Use %*%, NOT *! |
| Element-wise multiply | A * B |
NOT matrix multiplication |
| Transpose | t(A) |
Switches rows & columns |
| Determinant | det(A) |
Only for square matrices |
| Inverse | solve(A) |
Only if det(A) != 0 |
| Diagonal | diag(A) |
Extracts diagonal elements |
| Create diagonal matrix | diag(c(1,2,3)) |
Returns a diagonal matrix |
| Solve linear system | solve(A, b) |
Solves $Ax = b$ |
| Eigenvalues | eigen(A)$values |
For square matrices |
| Eigenvectors | eigen(A)$vectors |
Critical distinction — * vs %*%:
A <- matrix(1:4, nrow = 2) # A = [1 3; 2 4]
B <- matrix(4:1, nrow = 2) # B = [4 2; 3 1]
A * B # Element-wise: [1*4 3*2; 2*3 4*1] = [4 6; 6 4]
A %*% B # Matrix mult: [1*4+3*3 1*2+3*1; 2*4+4*3 2*2+4*1] = [13 5; 20 8]
1.5 Dimension Properties
dim(A) # Returns c(nrow, ncol)
nrow(A) # Number of rows
ncol(A) # Number of columns
length(A) # Total elements (nrow * ncol)
1.6 Likely Exam Question Format
Question type: You are given data on (e.g.) test scores from different groups. Create a matrix in R, compute summary statistics using matrix operations, find the inverse, solve a system, or interpret output.
Example question:
The marks of three students in three subjects are given below:
- Student 1: Maths 80, Stats 75, CS 90
- Student 2: Maths 65, Stats 85, CS 70
- Student 3: Maths 92, Stats 78, CS 88
(a) Create a matrix
marksin R usingrbind(). Assign row names and column names. (b) Find the total marks for each student using matrix multiplication with a vector of weights (1,1,1). (c) Compute the average marks per subject usingcolMeans(). (d) Find the determinant and inverse of the marks matrix. What does the determinant tell you?
Model answer:
# (a)
marks <- rbind(c(80, 75, 90),
c(65, 85, 70),
c(92, 78, 88))
rownames(marks) <- c("Student1", "Student2", "Student3")
colnames(marks) <- c("Maths", "Stats", "CS")
# (b) — matrix multiplication with weights vector
weights <- c(1, 1, 1)
total_marks <- marks %*% weights # returns a 3x1 matrix
# (c)
colMeans(marks)
# (d)
det(marks)
solve(marks) # if det != 0
[!warning] Hypothesis Testing in R NOT Tested Chen Jing confirmed: Hypothesis testing IN R is NOT coming out. All Q5 work is by-hand (Z-table, t-table, formulas). The
t.test(),z.test(), andshapiro.test()R functions and their output interpretation will NOT appear. Onlysummary()descriptive stats output is relevant for R output questions.
2. R Language — Descriptive Stats Output (Section B)
2.1 Interpreting summary() Output for Vectors
summary(heights)
Min. 1st Qu. Median Mean 3rd Qu. Max.
165.0 168.0 170.0 169.9 172.0 175.0
2.2 Common Exam Traps
| Trap | Correct Interpretation |
|---|---|
| "p-value = 0.03 means there is a 3% chance $H_0$ is true" | Wrong. p-value is P(data or more extreme | $H_0$ true), not P($H_0$ true | data). |
| "The 95% CI contains $\mu_0$, so we accept $H_0$" | Better: We "fail to reject $H_0$". We never "accept" $H_0$. |
| "t = -1.68 means the test is not significant" | Not directly. You must compare p-value to $\alpha$ or compare |
| "Since $n$ is small, use z-test" | Wrong. Small $n$ + $\sigma$ unknown → t-test. |
| "p-value > $\alpha$ proves $H_0$ is true" | Wrong. It just means insufficient evidence to reject $H_0$. |
Mistaking * for %*% in R |
A * B is element-wise; A %*% B is matrix multiplication. |
3. Permutation & Counting (Section B)
3.1 Quick Formula Reference
| Situation | Formula | When to Use |
|---|---|---|
| Permutation (no repetition) | $P(n,r) = \dfrac{n!}{(n-r)!}$ | Order matters, pick $r$ from $n$, no reuse |
| Permutation (with repetition) | $n^r$ | Order matters, pick $r$ from $n$, reuse allowed |
| Permutation (identical objects) | $\dfrac{n!}{n_1!,n_2!,\cdots,n_k!}$ | Arranging $n$ objects where some are identical |
| Circular permutation (different orientations) | $(n-1)!$ | Round table, rotations count as same |
| Circular permutation (same when flipped) | $\dfrac{(n-1)!}{2}$ | Ring/necklace, flip is same as rotation |
| Combination | $C(n,r) = \dbinom{n}{r} = \dfrac{n!}{r!(n-r)!}$ | Order does NOT matter |
| Multiplication rule | $m \times n \times \cdots$ | Sequential choices from categories |
| Complementary counting | Total $-$ Invalid | "At least one", "not together" problems |
| Grouping method | (block arrangements) $\times$ (within-block arrangements) | Items that must be together |
3.2 Decision Flowchart
graph TD
START([Problem]) --> Q1{Does order matter?}
Q1 -->|No| COMB[Combination C(n,r)]
Q1 -->|Yes| Q2{Restrictions?}
Q2 -->|Items together| GROUP[Grouping method<br/>block × internal]
Q2 -->|Items apart| COMPL[Total − together]
Q2 -->|First/last fixed| FIX[Fix positions,<br/>arrange remaining]
Q2 -->|No restrictions| Q3{All objects used?}
Q3 -->|Yes| Q4{Identical objects?}
Q4 -->|Yes| IDENT[n! / n₁! n₂! ...]
Q4 -->|No| ALL[n!]
Q3 -->|No, pick r from n| Q5{Repetition allowed?}
Q5 -->|Yes| REP[n^r]
Q5 -->|No| NPR[P(n,r)]
style START fill:#e7f5ff,stroke:#1971c2
style Q1 fill:#fff4e6,stroke:#e67700
style COMB fill:#d3f9d8,stroke:#2f9e44
style GROUP fill:#e5dbff,stroke:#5f3dc4
style COMPL fill:#e5dbff,stroke:#5f3dc4
style FIX fill:#e5dbff,stroke:#5f3dc4
style ALL fill:#ffe8cc,stroke:#d9480f
style IDENT fill:#ffe8cc,stroke:#d9480f
style REP fill:#ffe8cc,stroke:#d9480f
style NPR fill:#ffe8cc,stroke:#d9480f
3.3 Multi-Step Section B Problem Types
Type 1: Arrangements with Restrictions (Classic Section B)
Eight members of a club stand in a line for a photo. Nayla and Dura refuse to stand next to each other. Find the number of possible arrangements.
Solution (complementary counting):
- Total arrangements without restriction: $8! = 40,320$
- Arrangements with Nayla and Dura together: treat them as one block → $7! \times 2! = 10,080$
- Valid arrangements: $40,320 - 10,080 = 30,240$
Type 2: Words with Identical Letters
How many ways can the letters of STATISTICS be arranged? $$\frac{10!}{3! \times 3! \times 2!}$$ (3 S's, 3 T's, 2 I's)
Type 3: Combined Counting + Probability
A committee of 5 is chosen from 6 boys and 4 girls. Find the probability that there are more boys than girls.
Solution:
- More boys than girls means: 4B1G or 5B0G
- $P = \dfrac{C(6,4)C(4,1) + C(6,5)}{C(10,5)}$
Type 4: Circular Arrangements
In how many ways can 6 people sit at a round table? $$(6-1)! = 5! = 120$$
How many ways can 10 different coloured beads be arranged to form a ring? $$\frac{(10-1)!}{2} = \frac{9!}{2} = 181,440$$
Type 5: Permutation with Repetition + Restrictions
Four-digit numbers are formed from ${1, 2, 3, 4, 5, 6}$. How many are greater than 2000? First digit ∈ {2,3,4,5,6} → 5 choices Remaining 3 digits: $6 \times 6 \times 6$ Total: $5 \times 6^3 = 1080$
3.4 Permutation vs Combination — Quick Test
| Phrase | Order Matters? | Use |
|---|---|---|
| "arrange in a row" | Yes | Permutation |
| "select a committee" | No | Combination |
| "PIN code" | Yes | Permutation |
| "choose a team" | No | Combination |
| "sit in a line" | Yes | Permutation |
| "sit around a table" | Yes (circular) | $(n-1)!$ |
| "number of ways to pick" | Usually No | Combination |
| "arrange the letters" | Yes | Permutation |
3.5 Likely Section B Question Structure
Expect a multi-part question like:
(a) How many arrangements of the word PROBABILITY are possible? [3 marks] (b) In how many of these arrangements do the two B's appear together? [3 marks] (c) If the letters are arranged at random, what is the probability the two B's are separated? [3 marks] (d) How many ways can the letters be arranged around a circle? [3 marks]
4. Hypothesis Testing (Section B)
4.1 The 4-Step Framework (Taught in L23-L24)
graph LR
S1["Step 1: State H₀ and H₁"] --> S2["Step 2: Compute test statistic<br/>Z or t"]
S2 --> S3["Step 3: Find p-value or<br/>compare to critical value"]
S3 --> S4["Step 4: Conclusion<br/>in context"]
Step 1: State the Hypotheses
| Test Type | $H_0$ | $H_1$ | Tail |
|---|---|---|---|
| Two-tailed | $\mu = \mu_0$ | $\mu \neq \mu_0$ | Both tails |
| Right-tailed | $\mu \leq \mu_0$ | $\mu > \mu_0$ | Right tail |
| Left-tailed | $\mu \geq \mu_0$ | $\mu < \mu_0$ | Left tail |
Step 2: Choose and Compute the Test Statistic
| Condition | Test Statistic | Distribution |
|---|---|---|
| $\sigma$ known, any $n$ | $z = \dfrac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}$ | $N(0,1)$ |
| $\sigma$ unknown, $n \geq 30$ | $z = \dfrac{\bar{x} - \mu_0}{s / \sqrt{n}}$ | $N(0,1)$ (CLT) |
| $\sigma$ unknown, $n < 30$ | $t = \dfrac{\bar{x} - \mu_0}{s / \sqrt{n}}$ | $t_{n-1}$ |
Step 3: Decision Rule
Critical Value Method:
- Reject $H_0$ if test statistic falls in rejection region
- Two-tailed: reject if $|z| > z_{\alpha/2}$ or $|t| > t_{\alpha/2, n-1}$
- Right-tailed: reject if $z > z_\alpha$ or $t > t_{\alpha, n-1}$
- Left-tailed: reject if $z < -z_\alpha$ or $t < -t_{\alpha, n-1}$
P-value Method:
- Two-tailed: $p = 2 \times P(Z > |z|)$ or $2 \times P(T > |t|)$
- Right-tailed: $p = P(Z > z)$ or $P(T > t)$
- Left-tailed: $p = P(Z < z)$ or $P(T < t)$
- Reject $H_0$ if $p \leq \alpha$
Step 4: Conclusion
If reject $H_0$: "At the $\alpha$ significance level, there is sufficient evidence to conclude that [claim in $H_1$]."
If fail to reject $H_0$: "At the $\alpha$ significance level, there is insufficient evidence to conclude that [claim in $H_1$]."
4.2 z-test vs t-test — When to Use
| z-test | t-test | |
|---|---|---|
| $\sigma$ known? | Yes | No (use $s$) |
| Sample size | Any (with $\sigma$) or $n \geq 30$ | Any, but especially $n < 30$ |
| Distribution | Standard normal $N(0,1)$ | $t$ with $df = n-1$ |
4.3 Full Worked Example (Section B Style)
Problem: The mean cost of a hotel room in KL is said to be RM168 per night. A random sample of 25 hotels resulted in $\bar{x} = \text{RM}172.50$ and $s = \text{RM}15.40$. Test at $\alpha = 0.05$ whether the mean cost differs from RM168. Assume normality.
Step 1: Hypotheses $$H_0: \mu = 168 \quad \text{vs} \quad H_1: \mu \neq 168$$
Step 2: Test Statistic $n = 25$, $\sigma$ unknown → t-test with $df = 24$ $$t = \frac{172.50 - 168}{15.40 / \sqrt{25}} = \frac{4.50}{3.08} = 1.46$$
Step 3: Decision Rule (Critical Value Method) At $\alpha = 0.05$, two-tailed, $df = 24$: Critical value: $t_{0.025, 24} = \pm 2.064$
Since $|1.46| < 2.064$, we fail to reject $H_0$.
Step 3 (Alternative — P-value Method): $$p = 2 \times P(T_{24} > 1.46) = 2 \times 0.0785 = 0.157$$ Since $p = 0.157 > 0.05$, fail to reject $H_0$.
Step 4: Conclusion At the 5% significance level, there is insufficient evidence to conclude that the mean cost of a hotel room in KL differs from RM168.
4.4 P-value Interpretation
- p-value ≤ $\alpha$ → Reject $H_0$ (statistically significant result)
- p-value > $\alpha$ → Fail to reject $H_0$ (not statistically significant)
- Small p-value → Strong evidence against $H_0$
- Large p-value → Weak evidence against $H_0$
Common thresholds:
| $\alpha$ | Interpretation |
|---|---|
| 0.10 | Marginal significance |
| 0.05 | Standard significance |
| 0.01 | Strong significance |
4.5 Likely Section B Question Structure
Expect a multi-part question like:
A factory produces packets of cereal with a labelled weight of 500g. A sample of 36 packets has mean weight 505g and standard deviation 12g.
(a) State the null and alternative hypotheses to test if the mean weight differs from 500g. [2 marks] (b) Calculate the test statistic. [3 marks] (c) Determine the critical value at $\alpha = 0.05$ and make a decision. [3 marks] (d) Interpret the p-value if it is 0.013. [2 marks]
Quick-Reference Tables
R Matrix Functions Cheatsheet
| Task | R Code |
|---|---|
| Create matrix (col-wise) | matrix(data, nrow, ncol) |
| Create matrix (row-wise) | matrix(data, nrow, ncol, byrow = TRUE) |
| Bind rows | rbind(row1, row2) |
| Bind columns | cbind(col1, col2) |
| Matrix multiplication | A %*% B |
| Element-wise multiply | A * B |
| Transpose | t(A) |
| Determinant | det(A) |
| Inverse | solve(A) |
| Diagonal | diag(A) |
| Row names | rownames(A) <- c(...) |
| Column names | colnames(A) <- c(...) |
| Dimensions | dim(A), nrow(A), ncol(A) |
| Subset row i, col j | A[i, j] |
| Means per column | colMeans(A) |
| Sums per row | rowSums(A) |
Hypothesis Testing Cheatsheet
| Step | Action |
|---|---|
| 1. Hypotheses | $H_0$: no effect (=, ≤, ≥); $H_1$: research claim (≠, >, <) |
| 2. Test statistic | $z = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}$ or $t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}$ |
| 3. Decision | Critical value: compare |
| 4. Conclusion | In context: "sufficient/insufficient evidence" |
| Scenario | Test |
|---|---|
| $\sigma$ known, test mean | z-test |
| $\sigma$ unknown, $n \geq 30$ | z-test with $s$ |
| $\sigma$ unknown, $n < 30$ | t-test |
Counting & Permutation Cheatsheet
| Problem Type | Formula |
|---|---|
| Arrange $n$ distinct objects | $n!$ |
| Pick and arrange $r$ from $n$ | $P(n,r) = \frac{n!}{(n-r)!}$ |
| Pick $r$ from $n$ with repetition | $n^r$ |
| Arrange with identical objects | $\frac{n!}{n_1! n_2! \cdots n_k!}$ |
| Circular arrangements (different) | $(n-1)!$ |
| Circular arrangements (same) | $\frac{(n-1)!}{2}$ |
| Select $r$ from $n$ (order irrelevant) | $C(n,r) = \frac{n!}{r!(n-r)!}$ |
| Sequential choices | Multiplication rule |
Revision Checklists
R Matrix Operations
- [ ] Can I create a matrix using
matrix(),rbind(),cbind()? - [ ] Do I remember the difference between
A * BandA %*% B? - [ ] Can I compute determinant, inverse, transpose in R?
- [ ] Can I subset rows and columns?
- [ ] Can I assign and use row/column names?
R Output Interpretation
- [ ] Can I identify output from
summary()— min, Q1, median, mean, Q3, max? - [ ] Can I interpret
plot()output and scatterplots?
Permutation & Counting
- [ ] Can I distinguish between permutation (order matters) and combination (order doesn't)?
- [ ] Do I know all the permutation formulas (with/without repetition, identical, circular)?
- [ ] Can I use complementary counting ("at least one", "not together")?
- [ ] Can I use the grouping method for items that must stay together?
- [ ] Can I solve multi-step probability problems using counting methods?
Hypothesis Testing
- [ ] Can I write $H_0$ and $H_1$ correctly for any problem?
- [ ] Do I know when to use z-test vs t-test?
- [ ] Can I compute the test statistic manually?
- [ ] Can I find critical values (z or t) for a given $\alpha$?
- [ ] Can I interpret p-values correctly?
- [ ] Can I write the conclusion in proper context?
Related Resources
- Counting & Probability — full concept page on counting rules
- Hypothesis Testing — full concept page on hypothesis testing theory
- Matrices — full concept page on matrix algebra
- FAD1015 Week 1 — Counting Rules & Permutation — source lecture on counting
- FAD1015 L23-L24 — Hypothesis Testing About the Mean — theoretical foundation
- FAD1015 L25-L26 — Hypothesis Testing in R — R implementation
- FAD1015 L27-L28 — Matrices (Types, Operations & Determinants) — matrix basics
- FAD1015 L29-L30 — Matrices (Inverse & Systems of Equations) — advanced matrices
- FAD1015 Mastery Set — Interleaved Mathematics III — practice problems
Related Course Page
Last updated: 2026-05-02 based on LEAK/EXAM TIPS. All four topics likely appear in Section B. Lecturer solved in ~35 minutes — pace yourself accordingly. Good luck!
#fad1015 #exam-prep #synthesis #leak #r-programming