55.8 KB · commit a9602da
| title | ECE 2213 · 2023 Exam Style Answers |
|---|
RUET · ECE Dept · B.Sc. Engineering 2nd Year Even Semester Examination, 2023 Full Marks: 80 · Time: 03 Hours · CLO-mapped
Analytical solution. The governing equation is solved by manipulating symbols to get a closed form. The answer is exact and valid at every point of the domain.
Numerical solution. The equation is discretised, that is approximated by a form that can be evaluated. The answer is a pair of numbers, valid only near the point where it was computed.
| Analytical | Numerical | |
|---|---|---|
| Result | Closed form, exact | Approximate |
| Domain | Whole domain | Local, near one point |
| Difficulty of problem | May be impossible | Grows slowly with size |
| Cost per answer | Fixed once derived | Grows with problem size |
| Round off error | None | Present |
| Typical size | Thousands of equations | Millions |
Differences in detail.
Significance of numerical analysis in engineering.
Exact value. At x=y=z=1:
u=135(1)(1)2=5In numerical analysis and error propagation theory, errors given for measured variables (Δx,Δy,Δz=0.001) can be interpreted in two ways:
Here ∣Δx∣≤0.001,∣Δy∣≤0.001,∣Δz∣≤0.001. Taking the natural logarithm:
lnu=ln5+lnx+2lny−3lnzTaking total differentials:
udu=xdx+2ydy−3zdzThe maximum relative error occurs when errors in the variables conspire in the worst-case direction (triangle inequality / absolute bounds):
(er)max=uΔumax≈xΔx+2yΔy+3zΔzSubstituting x=y=z=1 and ∣Δx∣=∣Δy∣=∣Δz∣=0.001:
(er)max=10.001+2(10.001)+3(10.001)=(1+2+3)(0.001)=0.006(0.6%)The corresponding maximum absolute error is:
(Δu)max=∣u∣⋅(er)max=5×0.006=0.030 (er)max=0.006(0.6%),(Δu)max=0.030If the errors have identical signs (Δx=Δy=Δz=+0.001):
up=(1.001)35(1.001)(1.001)2=(1.001)35(1.001)3=5 Δu=up−u=5−5=0⟹er=uΔu=0Via differential: udu=0.001+2(0.001)−3(0.001)=0.
er=0(if signs are identically +0.001)Derivation. Let the root of f(x)=0 be x∗. Start at x0 and move along the tangent to the curve at that point.
For small h, the tangent meets the x-axis at x0+h, and by the first-order mean value form of the Taylor series,
0=f(x∗)=f(x0+h)≈f(x0)+hf′(x0)Solving for h and substituting x1=x0+h,
x1=x0−f′(x0)f(x0)Repeating gives the iteration
xn+1=xn−f′(xn)f(xn)The derivative may be written f′(xn)=limh→0hf(xn+h)−f(xn) if it is not available analytically.
Second order accuracy. The Taylor expansion with the second-order term gives
f(x∗)=0=f(xn)+f′(xn)Δx+2f′′(ξ)Δx2Substituting Δx=−f/f′ shows the error satisfies en+1≈2f′(x∗)f′′(x∗)en2, so the error is squared at every step. Doubling the accuracy costs one further derivative evaluation.
Problems and their fixes
| Problem | Cause | Fix |
|---|---|---|
| Diverges or oscillates | Initial guess too far, or f′ small | Bracket the root first and start inside, or use bisection or secant |
| Division by zero | f′(xn)=0, a stationary point | Choose another start, or use a method that does not divide by f′ |
| Cycle between two points | Overshoot from a bad start | Damp the step, or switch to bisection when two successive values repeat |
| False convergence to a stationary point | f(xn)=0 but f′(xn)=0 | Always check ∣f(xn)∣, not only ∣xn+1−xn∣ |
| Slow near a repeated root | Error is squared only for a simple root | Use the modified form xn+1=xn−mf′(xn)f(xn) with m the multiplicity |
| Non-convergence on a step-like function | No tangent information, as on a signum | Use bisection, which needs only a sign change |
| f′ not available | Only a formula for f | Use the secant method, which builds the derivative from two points |
The general safeguard. Keep a bracket [a,b] with f(a)f(b)<0. If the Newton step leaves the bracket, fall back to bisection. This hybrid converges with Newton's speed and bisection's guarantee, and it is the form used in production root finders.
Setup. Let y=f(x) be given at n+1 equally spaced points: x0,x1=x0+h,x2=x0+2h,…,xn=x0+nh with corresponding values y0,y1,y2,…,yn.
Let x=x0+ph, so p=hx−x0 represents the number of intervals from x0.
Step 1. Assume the interpolating polynomial. Let Pn(x) be a polynomial of degree n written in Newton's form:
Pn(x)=a0+a1(x−x0)+a2(x−x0)(x−x1)+a3(x−x0)(x−x1)(x−x2)+⋯+an(x−x0)(x−x1)⋯(x−xn−1)where a0,a1,a2,…,an are constants to be determined.
Step 2. Determine the coefficients ak. The polynomial must satisfy the interpolation condition Pn(xi)=yi for i=0,1,…,n:
At x=x0: Pn(x0)=a0=y0⟹a0=y0
At x=x1=x0+h: Pn(x1)=a0+a1(x1−x0)=y0+a1h=y1 a1=hy1−y0=1!hΔy0
At x=x2=x0+2h: Pn(x2)=a0+a1(2h)+a2(2h)(h)=y2 y0+2Δy0+2h2a2=y2 2h2a2=y2−2y1+y0=Δ2y0⟹a2=2!h2Δ2y0
In general, by mathematical induction: ak=k!hkΔky0for k=0,1,2,…,n
Step 3. Substitute x=x0+ph. Notice that: x−x0=ph x−x1=ph−h=(p−1)h x−x2=ph−2h=(p−2)h ⋮ (x−x0)(x−x1)⋯(x−xk−1)=[ph][(p−1)h]⋯[(p−k+1)h]=p(p−1)⋯(p−k+1)hk
Substituting the expressions for ak and (x−x0)⋯(x−xk−1) into the k-th term of Pn(x):
ak(x−x0)(x−x1)⋯(x−xk−1)=k!hkΔky0⋅[p(p−1)⋯(p−k+1)hk]=k!p(p−1)⋯(p−k+1)Δky0Step 4. Final formula. Substituting all terms into Pn(x) gives Newton's Forward Difference Interpolation formula:
yn(x)=y0+pΔy0+2!p(p−1)Δ2y0+3!p(p−1)(p−2)Δ3y0+⋯+n!p(p−1)⋯(p−n+1)Δny0where p=hx−x0.
| x | 0 | 1 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| y | 0 | 1 | 81 | 256 | 625 |
Step 1. The formula. With five points x0=0,x1=1,x2=3,x3=4,x4=5,
y(2)=i=0∑4yiLi(2),Li(2)=j=i∏xi−xj2−xjStep 2. Compute each weight. Keep the four numerator factors and the four denominator factors separate, since the denominator carries four sign factors.
L0(2)=(0−1)(0−3)(0−4)(0−5)(2−1)(2−3)(2−4)(2−5)=(−1)(−3)(−4)(−5)(1)(−1)(−2)(−3)=60−6=−101 L1(2)=(1−0)(1−3)(1−4)(1−5)(2−0)(2−3)(2−4)(2−5)=(1)(−2)(−3)(−4)(2)(−1)(−2)(−3)=−24−12=21 L2(2)=(3−0)(3−1)(3−4)(3−5)(2−0)(2−1)(2−4)(2−5)=(3)(2)(−1)(−2)(2)(1)(−2)(−3)=1212=1 L3(2)=(4−0)(4−1)(4−3)(4−5)(2−0)(2−1)(2−3)(2−5)=(4)(3)(1)(−1)(2)(1)(−1)(−3)=−126=−21 L4(2)=(5−0)(5−1)(5−3)(5−4)(2−0)(2−1)(2−3)(2−4)=(5)(4)(2)(1)(2)(1)(−1)(−2)=404=101Check. The weights must sum to 1: −101+21+1−21+101=1 ✓
Step 3. Assemble.
y(2)=(0)(−101)+(1)(21)+(81)(1)+(256)(−21)+(625)(101)=0+0.5+81−128+62.5=16 y(2)=16Step 1. The first column, composite trapezoid.
Tn=2h[f0+2f1+2f2+⋯+2fn−1+fn]At h=0.5 the nodes are x=1,1.5,2 and f(x)=1/(2+x):
T2=20.5[31+2⋅3.51+41]=0.25[0.333333+0.571429+0.25]=0.2886904762At h=0.25, n=4:
T4=20.25[31+2(3.251+3.51+3.751)+41]=0.2879349817At h=0.125, n=8:
T8=0.2877453510Step 2. The second column, Richardson extrapolation to Simpson's rule. Since the trapezoid rule carries an O(h2) error, extrapolate with the factor 4−1=3:
Rk,1=Rk,0+41−1Rk,0−Rk−1,0| k | Rk,0 (trapezoid) | Rk,1 (Simpson) |
|---|---|---|
| 1 | 0.2886904762 | |
| 2 | 0.2879349817 | 0.2876831502 |
| 3 | 0.2877453510 | 0.2876821408 |
Check on row 2: 0.2879349817+30.2879349817−0.2886904762=0.2879349817−0.0002518315=0.2876831502.
Step 3. The third column, order four. Simpson carries an O(h4) error, so the factor is 42−1=15:
R3,2=R3,1+42−1R3,1−R2,1 R3,2=0.2876821408+150.2876821408−0.2876831502=0.2876821408−0.0000000673=0.2876820735The Romberg table
Rk,00.28869047620.28793498170.2877453510Rk,10.28768315020.2876821408Rk,20.2876820735 I≈0.2876820735Step 1. Characteristic equation. Eigenvalues satisfy det(A−λI)=0.
A−λI=5−λ010−2−λ0105−λExpand along the second row, which holds a single entry:
det(A−λI)=(−2−λ)5−λ115−λ =(−2−λ)[(5−λ)(5−λ)−1]=(−2−λ)(5−λ)2−(−2−λ) =(−2−λ)[(5−λ)2−1]=(−2−λ)[(5−λ)−1][(5−λ)+1] =(−2−λ)(4−λ)(6−λ)=0 λ1=6,λ2=4,λ3=−2Step 2. Eigenvector for λ1=6. Solve (A−6I)v=0:
−1010−8010−1v1v2v3=0Row 1 gives −v1+v3=0, so v3=v1. Row 2 gives −8v2=0, so v2=0. Take v1=1:
v(1)=101,∥v(1)∥=2,v^(1)=21101Step 3. Eigenvector for λ2=4. Solve (A−4I)v=0:
1010−60101v1v2v3=0Row 1 gives v1+v3=0, so v3=−v1. Row 2 gives v2=0. Take v1=−1, so v3=1:
v(2)=−101,∥v(2)∥=2,v^(2)=21−101Step 4. Eigenvector for λ3=−2. Solve (A+2I)v=0:
701000107v1v2v3=0Row 1 gives 7v1+v3=0, so v3=−7v1. Row 2 is 0=0, so v2 is free. Take v1=0, hence v3=0, and v2=1:
v(3)=010,∥v(3)∥=1,v^(3)=010Answer
λ1=6, v^(1)=21101;λ2=4, v^(2)=21−101;λ3=−2, v^(3)=010Euler's method. Take the slope at the left end of each step and project it straight:
yn+1=yn+hf(xn,yn),xn+1=xn+h(i) y′=53x3y, y(0)=1, h=0.25
| Step | xn | yn | Slope 53xn3yn | yn+1=yn+h⋅slope |
|---|---|---|---|---|
| 1 | 0.00 | 1.0000000 | 53(0)3(1)=0 | 1+0.25(0)=1.0000000 |
| 2 | 0.25 | 1.0000000 | 53(0.25)3(1)=0.0093750 | 1+0.25(0.009375)=1.0023440 |
| 3 | 0.50 | 1.0023438 | 53(0.5)3(1.002344)=0.0751758 | 1.002344+0.25(0.075176)=1.0211377 |
| 4 | 0.75 | 1.0211377 | 53(0.75)3(1.021138)=0.2584755 | 1.021138+0.25(0.258475)=1.0857566 |
(ii) y′=1+y2, y(0)=0, h=0.25
| Step | xn | yn | Slope 1+yn2 | yn+1 |
|---|---|---|---|---|
| 1 | 0.00 | 0.0000000 | 1.0000000 | 0+0.25(1)=0.2500000 |
| 2 | 0.25 | 0.2500000 | 1.0625000 | 0.25+0.25(1.0625)=0.5156250 |
| 3 | 0.50 | 0.5156250 | 1.2658691 | 0.515625+0.25(1.265869)=0.8320923 |
| 4 | 0.75 | 0.8320923 | 1.6923776 | 0.832092+0.25(1.692378)=1.2551867 |
All three take discrete data and produce a continuous relation. They differ in what they promise.
Interpolation. Build a function that passes through every given point exactly.
P(xi)=yifor every iThe answer is exact at the data and carries no modelling error. Example: a thermocouple is calibrated at 0∘C and 100∘C, and its reading at 37∘C is found by interpolating between those two calibrations.
Extrapolation. Evaluate a fitted function outside the range of the data. The function may pass through every point and still say nothing trustworthy outside, because nothing constrains it there.
Example: predicting the sales figure for next year from five years of history. The fit is exact on those five years and still can be badly wrong on the sixth.
Curve fitting. Find the function that comes closest to all points without passing through any, by minimising a misfit such as ∑i[yi−f(xi)]2.
Example: fitting a straight line to seven noisy voltage readings to recover the true calibration slope.
| Interpolation | Extrapolation | Curve fitting | |
|---|---|---|---|
| Passes through data | Yes | May or may not | No |
| Outside the data | Not defined | Defined but unreliable | Defined, degree dependent |
| Data assumed | Exact | Exact | Noisy |
| Point count | Need n+1 points for degree n | Same | Can use fewer |
| Risk | Runge oscillation far out | Large and growing error | Under-fitting if too simple |
Choosing between them. Interpolate inside the data. Fit when the data are noisy, or when the underlying trend is the object of interest. Extrapolation is required only when the target lies outside the data range, and only over a short distance, no more than about one data interval.
interpolation passes through, extrapolation goes beyond, fitting minimisesThe integrand is the velocity function:
f(t)=2000ln(140000−2100t140000)−9.8tIntegration limits: a=8 s, b=30 s, total interval width b−a=22 s.
In standard numerical textbooks (e.g., Autar Kaw's classic rocket problem), "Simpson's 1/3rd rule" refers directly to the fundamental 2-segment rule (n=2):
Step 1. Grid setup (n=2, h=11). h=2b−a=230−8=11 s The 3 evaluation nodes are t0=8, t1=19, and t2=30:
Step 2. Compute approximate distance x.
x≈3h[f(t0)+4f(t1)+f(t2)]=311[177.2667+4(484.7455)+901.6740]=311[177.2667+1938.9820+901.6740]=311[3017.9227]=11065.7166 m (i) x≈11065.72 mStep 3. Exact value & errors. The exact analytical integral (via integration by parts ∫ln(A−kt)dt=tln(A−kt)−t−kAln(A−kt)):
Iexact=∫830f(t)dt=11061.34 m(The negative sign indicates that Simpson's rule overestimated the true distance).
If evaluated with unit step size h=1 (n=22 subintervals):
| Feature | Simpson's 1/3rd Rule | Simpson's 3/8th Rule |
|---|---|---|
| Formula weights | 1,4,2,4,…,4,1 (coefficients 3h[1,4,1]) | 1,3,3,2,3,3,…,3,1 (coefficients 83h[1,3,3,1]) |
| Panel width | 2h (fits a 2nd-degree parabola) | 3h (fits a 3rd-degree cubic) |
| Subintervals per panel | 2 | 3 |
| Subinterval constraint (n) | n must be even (2∣n) | n must be a multiple of 3 (3∣n) |
| Order of accuracy | 4th order (O(h4)) | 4th order (O(h4)) |
| Truncation error | −180(b−a)h4f(4)(ξ) | −80(b−a)h4f(4)(ξ) |
| Error constant | 1801≈0.00556 | 801=0.0125 |
| Degree of precision | 3 (exact for polynomials of degree ≤3) | 3 (exact for polynomials of degree ≤3) |
Key comparative points:
Step 1. Simplify algebraically. Factor ¬r out of the two bracketed terms, since it appears in both:
F=(p∨¬r)∧(¬p∨q∨¬r)Use (a∨c)∧(b∨c)=(a∧b)∨c with c=¬r, a=p, b=(¬p∨q):
F=¬r∨[p∧(¬p∨q)]Distribute inside the bracket, p∧(¬p∨q)=(p∧¬p)∨(p∧q)=0∨(p∧q)=p∧q:
F=¬r∨(p∧q)Step 2. Read off the circuit.
Logic Circuit Diagram (Simplified Form):

Alternative: Direct (Unsimplified) Circuit: If implemented directly as (p∨¬r)∧(¬p∨(q∨¬r)):

Translate the statements. The four suspects are mutually exclusive, so exactly one of them did it. Let the culprit be one of A,J,C,D.
| Statement | True when |
|---|---|
| SA: "Carlos did it" | culprit =C |
| SJ: "I did not do it" | culprit =J |
| SC: "Diana did it" | culprit =D |
| SD: "Carlos lied when he said I did it" | Carlos's claim was false, that is culprit =D |
Note that SC and SD are exact negations of each other, so exactly one of them is always true. This observation drives both parts.
(i) Exactly one telling the truth
Test each culprit:
| Culprit | SA | SJ | SC | SD | True count |
|---|---|---|---|---|---|
| A | F | T | F | T | 2 |
| J | F | F | F | T | 1 |
| C | T | T | F | T | 3 |
| D | F | T | T | F | 2 |
Only one row gives a count of 1.
(i) John did it
Reasoning without a table. Since SC and SD are negations, one of them must be true, so the single truth must be one of those two, and both Alice and John must be lying. John lying means "I did not do it" is false, so John did it. Check: John lying, Carlos lying (Diana did not do it), Alice lying (Carlos did not do it), Diana telling the truth (Carlos's claim was false). Exactly one truth. ✓
(ii) Exactly one lying
Equivalently, exactly three telling the truth. The same table, reading the false count:
| Culprit | SA | SJ | SC | SD | Lying count |
|---|---|---|---|---|---|
| A | F | T | F | T | 2 |
| J | F | F | F | T | 3 |
| C | T | T | F | T | 1 |
| D | F | T | T | F | 2 |
Only one row gives a lying count of 1.
(ii) Carlos did it
Reasoning without a table. Exactly one lying means Alice and Diana are both telling the truth, since they cannot both lie. Alice true gives culprit =C. Then John says "I did not do it", which is true since Carlos did it, and Carlos says "Diana did it", which is false. Exactly one lie, Carlos's. ✓
(i) ¬(p→q)→p
p→q is F only when p=T,q=F. So ¬(p→q) is T only there.
| p | q | p→q | ¬(p→q) | ¬(p→q)→p |
|---|---|---|---|---|
| F | F | T | F | T |
| F | T | T | F | T |
| T | F | F | T | T |
| T | T | T | F | T |
The final column is T in every row.
Algebraic confirmation. ¬(p→q)=¬(¬p∨q)=p∧¬q. Then (p∧¬q)→p=¬(p∧¬q)∨p=(¬p∨q)∨p=⊤.
(i) ¬(p→q)→p is a tautology(ii) p→(p∨q)
| p | q | p∨q | p→(p∨q) |
|---|---|---|---|
| F | F | F | T |
| F | T | T | T |
| T | F | T | T |
| T | T | T | T |
The final column is T in every row.
Algebraic confirmation. p→(p∨q)=¬p∨(p∨q)=(¬p∨p)∨q=⊤.
(ii) p→(p∨q) is a tautologyStep 1. Build the truth table.
| p | q | p↔q | ¬(p↔q) | ¬p | ¬p↔q |
|---|---|---|---|---|---|
| F | F | T | F | T | F |
| F | T | F | T | T | T |
| T | F | F | T | F | T |
| T | T | T | F | F | F |
The two computed columns are identical: F, T, T, F reading down the rows FF, FT, TF, TT. Hence the formulas are logically equivalent.
¬(p↔q)≡(¬p↔q)Step 2. Algebraic proof. Rewrite both sides.
¬(p↔q)=¬[(p→q)∧(q→p)]=¬(p→q)∨¬(q→p)=(p∧¬q)∨(¬p∧q)This is exclusive-or. Now the right-hand side,
¬p↔q=(¬p→q)∧(q→¬p)=(p∨q)∧(¬q∨¬p)Distribute:
(p∨q)∧(¬q∨¬p)=[(p∧¬q)∨(p∧¬p)∨(q∧¬q)∨(q∧¬p)] =(p∧¬q)∨0∨0∨(¬p∧q)=(p∧¬q)∨(¬p∧q)Both sides reduce to the same expression, so the equivalence is proven.
In words. "p and q disagree" is exactly one true statement. If p is false, then "q agrees with ¬p" means q is true, which is precisely the case where they disagree. Flipping one input and asking for agreement tests the same thing as asking for disagreement without the flip.
All four are inference rules. Each is a valid argument form, meaning the conclusion is true whenever the premises are true.
1. Modus ponens (MP), affirming the antecedent
p→q,p ∴ q| p | q | p→q | Premises both true | Conclusion q |
|---|---|---|---|---|
| F | F | T | antecedent false | F |
| F | T | T | antecedent false | T |
| T | F | F | no | |
| T | T | T | yes | T ✓ |
Whenever both premises hold, so does the conclusion. Valid.
Example. "If the switch is closed the lamp is lit." The switch is closed. Therefore the lamp is lit.
2. Modus tollens (MT), denying the consequent
p→q,¬q ∴ ¬p| p | q | p→q | ¬q | Both true | Conclusion ¬p |
|---|---|---|---|---|---|
| F | F | T | T | yes | T ✓ |
| F | T | T | F | no | |
| T | F | F | T | no | |
| T | T | T | F | no |
Valid. MT is the contrapositive rule, since p→q≡¬q→¬p.
Example. "If the fuse has blown the lamp is dark." The lamp is not dark. Therefore the fuse has not blown.
3. Hypothetical syllogism (HS), chaining
p→q,q→r ∴ p→r| p | q | r | p→q | q→r | p→r |
|---|---|---|---|---|---|
| F | F | F | T | T | T |
| F | F | T | T | T | T |
| F | T | F | T | F | T |
| F | T | T | T | T | T |
| T | F | F | F | T | F |
| T | F | T | F | T | T |
| T | T | F | T | F | F |
| T | T | T | T | T | T |
Whenever both premises are T, so is p→r. Valid.
Example. "If it rains the ground is wet. If the ground is wet the crop grows." Therefore if it rains the crop grows.
4. Disjunctive syllogism (DS), eliminating by negation
p∨q,¬p ∴ q| p | q | p∨q | ¬p | Both true | Conclusion q |
|---|---|---|---|---|---|
| F | F | F | T | no | |
| F | T | T | T | yes | T ✓ |
| T | F | T | F | no | |
| T | T | T | F | no |
Valid.
Example. "The input is 0 or 1." The input is not 0. Therefore the input is 1.
Summary and comparison
| Rule | Form | Name | Uses |
|---|---|---|---|
| MP | p→q, p∴q | Affirming the antecedent | Forward chaining |
| MT | p→q, ¬q∴¬p | Denying the consequent, that is contraposition | Backward chaining |
| HS | p→q, q→r∴p→r | Transitivity | Chaining rules |
| DS | p∨q, ¬p∴q | Elimination | Splitting a case |
The invalid forms
| Form | Status | Why it fails |
|---|---|---|
| p→q, q∴p | Invalid (Fallacy of affirming the consequent) | Counterexample: p=F,q=T. Premises (F→T)=T and q=T are true, but conclusion p=F is false. |
| p→q, ¬p∴¬q | Invalid (Fallacy of denying the antecedent) | Counterexample: p=F,q=T. Premises (F→T)=T and ¬p=T are true, but conclusion ¬q=F is false. |
Both are the converse and inverse of a conditional, and a conditional is not equivalent to its converse or its inverse. It is equivalent only to its contrapositive ¬q→¬p, which is what MT uses.
MP, MT, HS, DS are valid; affirming the consequent and denying the antecedent are notAssign variables.
| Symbol | Meaning |
|---|---|
| S | it is sunny this afternoon |
| C | it is colder than yesterday |
| W | we go swimming |
| K | we take a canoe trip |
| H | we are home by sunset |
Translate the four hypotheses.
Extract what is needed. Split hypothesis 1 by simplification: ¬S and C. The proof needs only ¬S.
The goal is H, so work backwards from the rule that produces it. Rule 4 needs K, and rule 3 needs ¬W, and that comes from S by modus tollens on rule 2.
The valid argument, step by step.
| Step | Statement | Rule |
|---|---|---|
| 1 | ¬S∧C | Premise 1 |
| 2 | ¬S | Simplification, 1 |
| 3 | W→S | Premise 2 |
| 4 | ¬W | Modus tollens, 3 and 2 |
| 5 | ¬W→K | Premise 3 |
| 6 | K | Modus ponens, 5 and 4 |
| 7 | K→H | Premise 4 |
| 8 | H | Modus ponens, 7 and 6 |
Therefore, "we will be home by sunset" is a valid conclusion.
¬S⇒¬W⇒K⇒H,so H follows validlyWork entirely with the residues, then reduce to 0≤c≤12.
(i) c≡2a+3b(mod13)
c≡2(4)+3(9)=8+27=35(mod13)Divide: 35=13(2)+9.
c=9(ii) c≡a2+b2(mod13)
c≡42+92=16+81=97(mod13)Divide: 97=13(7)+6.
c=6Method 1, positional value.
(1110)2=1(23)+1(22)+1(21)+0(20)=8+4+2+0=14 (1011)2=1(23)+0(22)+1(21)+1(20)=8+0+2+1=11 14+11=25Convert back: 25=16+8+1=(11001)2.
Method 2, binary addition, column by column.
| Column | 24 | 23 | 22 | 21 | 20 |
|---|---|---|---|---|---|
| Carry row | 1 | 1 | 1 | 0 | - |
| a | 0 | 1 | 1 | 1 | 0 |
| b | 0 | 1 | 0 | 1 | 1 |
| Sum | 1 | 1 | 0 | 0 | 1 |
Working right to left:
Proof.
Let n be composite. Then by definition n=ab for integers a,b with 1<a<n and 1<b<n.
Key observation. At least one of a and b is at most n. Suppose both were larger:
a>nandb>n⟹ab>nn=nSince ab=n, this is a contradiction. Hence a≤n or b≤n.
WLOG suppose a≤n, so 1<a≤n.
Now find a prime divisor at most a. Every integer a>1 has a prime divisor: keep dividing by a prime factor until the result is 1, and the last prime divided out is a prime p dividing a. So there is a prime p with p∣a.
Since a∣n and p∣a, transitivity of divisibility gives p∣n. And p≤a≤n.
Every composite n has a prime divisor p with p≤nThe principle. If N objects are placed into k boxes and N>k, then at least one box holds at least two objects.
Proof. Suppose every box held at most one object. Then the boxes would hold at most k objects in total. But N>k, a contradiction.
Real-world examples.
Birthdays. With 366 possible birthdays, the plain principle needs 367 people to force a shared birthday, not 23. The famous result is therefore a probabilistic one, not a pigeonhole one: under a random model, past about 23 people the chance of a shared birthday exceeds 50%. Quoting 23 as a pigeonhole result is wrong, and it is the most common error in this topic.
Pigeonholes in a building. A building with n floors and n+1 people must have two on the same floor.
Socks. From a drawer holding black and white socks only, drawing three socks guarantees two of a colour, since two boxes cannot take three objects with at most one each.
Hash tables. Storing n keys in m buckets forces a collision once n>m, which is why the load factor is kept below 1.
Setting up. Selection is without regard to order, so order does not matter. Every crew member has the same job, so there is no assignment to count. This is a combination, (rn), not a permutation.
Ways=(630)=6!24!30!Computing the factorial ratio.
=6⋅5⋅4⋅3⋅2⋅130⋅29⋅28⋅27⋅26⋅25=72030⋅29⋅28⋅27⋅26⋅25Group the numerator in pairs:
30⋅29=870,28⋅27=756,26⋅25=650 870×756×650=427518000 720427518000=593775 (630)=593775 waysThe theorem. For positive integers m and n,
(x+y)n=r=0∑n(rn)xn−ryrThe general term is
Tr+1=(rn)xn−ryr,r=0,1,…,nA proof by induction on n: the case n=1 is immediate, and the step follows from Pascal's identity (rn+1)=(rn)+(r−1n) applied to (x+y)n+1=(x+y)n⋅(x+y).
Applying it. With x→2x and y→−3y and n=25,
(2x−3y)25=r=0∑25(r25)(2x)25−r(−3y)rIdentify the term. A general term carries x25−ryr. For x12y13 we need
25−r=12andr=13Both give r=13, and the powers 12+13=25 check out.
The coefficient.
coefficient=(1325)(2)12(−3)13Since (1325)=(1225)=5200300,
=5200300×4096×(−1594323) coefficient of x12y13=−33959763545702400Discrete mathematics supplies the exact language for the structures a computer represents, so that correctness and cost can be reasoned about rather than guessed at. Sets, relations, graphs, logic and counting describe what is stored and how it is linked; combinatorics counts the cases an algorithm must handle; logic gives proof rules that certify an algorithm correct.
Discrete mathematics is the language in which algorithms are specified, proved and costed