Skip to content

Commit fd5dcc3

Browse files
committed
Major refactor: Split notebook into 2 parts, and other visual improvements
1 parent ae48762 commit fd5dcc3

File tree

3 files changed

+725
-810
lines changed

3 files changed

+725
-810
lines changed
Lines changed: 378 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,378 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "72c44810-5086-4a40-8d8a-f825b064f14d",
6+
"metadata": {},
7+
"source": [
8+
"# Proof of the R-Formula\n",
9+
"\n",
10+
"The main goal is to find a unifying expression for\n",
11+
"\n",
12+
"$$\n",
13+
"a\\sin(x) \\pm b\\cos(x)\n",
14+
"$$\n",
15+
"\n",
16+
"And\n",
17+
"\n",
18+
"$$\n",
19+
"a\\cos(x) \\pm b\\sin(x)\n",
20+
"$$\n",
21+
"\n",
22+
"where\n",
23+
"$$\n",
24+
"a > 0 \\quad \\text{and} \\quad b > 0\n",
25+
"$$"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"id": "83da1681-d587-498d-9b07-38bac736c4b4",
31+
"metadata": {},
32+
"source": [
33+
"# **Cosine First**: $\\mathbf{a\\cos(x) \\pm b\\sin(x)}$\n",
34+
"\n",
35+
"\n",
36+
"## Finding Patterns in Identities\n",
37+
"\n",
38+
"Looking through the different trigonometric identities, we can find by that in the double-angle formula\n",
39+
"\n",
40+
"$$\n",
41+
"\\cos(A \\mp B) = \n",
42+
"\\cos(A)\\cos(B) \\pm \\sin(A)\\sin(B)\n",
43+
"$$ \n",
44+
"\n",
45+
"Its expanded form of \n",
46+
"\n",
47+
"$$\n",
48+
"\\textcolor{lightgray}{\\cos(A \\mp B)} \n",
49+
"\\textcolor{lightgray}{=} \n",
50+
"\\textcolor{green}{\\cos(A)}\n",
51+
"\\cos(B) \n",
52+
"\\pm \n",
53+
"\\textcolor{blue}{\\sin(A)}\n",
54+
"\\sin(B)\n",
55+
"$$ \n",
56+
"\n",
57+
"looks quite similar to:\n",
58+
"\n",
59+
"$$\n",
60+
"\\boxed{\n",
61+
" \\textcolor{green}{a}\\cos(x) \\pm \\textcolor{blue}{b}\\sin(x)\n",
62+
"}\n",
63+
"$$\n",
64+
"\n",
65+
"And has the unifying double-angle form of \n",
66+
"\n",
67+
"$$\n",
68+
"\\cos(A \\mp B) = \n",
69+
"\\textcolor{green}{\\cos(A)} \n",
70+
"\\textcolor{lightgray}{\\cos(B)} \n",
71+
"\\textcolor{lightgray}{\\pm}\n",
72+
"\\textcolor{blue}{\\sin(A)}\n",
73+
"\\textcolor{lightgray}{\\sin(B)}\n",
74+
"$$ \n",
75+
"\n",
76+
"## Matching Variables\n",
77+
"\n",
78+
"To match with $cos(x)$, we can let either let $A = x$ or $B = x$\n",
79+
"\n",
80+
"- I choose to let $B = x$\n",
81+
"\n",
82+
"$$\n",
83+
"\\cos(A \\mp x) = \\cos(A)\\cos(x) \\pm \\sin(A)\\sin(x)\n",
84+
"$$ \n",
85+
"\n",
86+
"It may seem that we can match $a$ with $\\cos(A)$ and $b$ with $\\sin(A)$\n",
87+
"\n",
88+
"$$\n",
89+
"\\textcolor{green}{a} \n",
90+
"\\textcolor{lightgray}{\\cos(x)} \n",
91+
"\\textcolor{lightgray}{\\pm} \n",
92+
"\\textcolor{blue}{b} \n",
93+
"\\textcolor{lightgray}{\\sin(x)} \n",
94+
"\\textcolor{lightgray}{=} \n",
95+
"\\textcolor{green}{\\cos(A)} \n",
96+
"\\textcolor{lightgray}{\\cos(x)} \n",
97+
"\\textcolor{lightgray}{\\pm} \n",
98+
"\\textcolor{blue}{\\sin(A)} \n",
99+
"\\textcolor{lightgray}{\\sin(x)}\n",
100+
"$$\n",
101+
"\n",
102+
"But actually, their ranges do not match.\n",
103+
"- $sin(A)$ and $cos(A)$ has the range of $[-1, 1]$\n",
104+
"- While both `a` and `b` has the range of $(0, \\infty)$\n",
105+
"\n",
106+
"Therefore, we need a coefficient on the double-angle formula to make the expressions matchable. \n",
107+
"- We can either have the coefficients individually\n",
108+
"\n",
109+
"$$\n",
110+
"\\textcolor{gray}{p} \n",
111+
"\\textcolor{lightgray}{\\cos(A)\\cos(x)} \n",
112+
"\\textcolor{lightgray}{\\pm} \n",
113+
"\\textcolor{gray}{q} \n",
114+
"\\textcolor{lightgray}{\\sin(A)\\sin(x)}\n",
115+
"$$\n",
116+
"\n",
117+
"- Or as we are finding unification, we can have some coefficient $R$ on the unified double-angle form, to distribute across the 2 terms\n",
118+
"\n",
119+
"$$\n",
120+
"R\\cos(A \\mp x) = R\\cos(A)\\cos(x) \\pm R\\sin(A)\\sin(x)\n",
121+
"$$ \n",
122+
"\n",
123+
"Now it can have the nice comparison of \n",
124+
"\n",
125+
"$$\n",
126+
"\\textcolor{green}{a}\n",
127+
"\\textcolor{lightgray}{\\cos(x)}\n",
128+
"\\textcolor{lightgray}{\\pm}\n",
129+
"\\textcolor{blue}{b}\n",
130+
"\\textcolor{lightgray}{\\sin(x)} \n",
131+
"\\textcolor{lightgray}{=} \n",
132+
"\\textcolor{green}{R\\cos(A)} \n",
133+
"\\textcolor{lightgray}{\\cos(x)} \n",
134+
"\\textcolor{lightgray}{\\pm} \n",
135+
"\\textcolor{blue}{R\\sin(A)} \n",
136+
"\\textcolor{lightgray}{\\sin(x)}\n",
137+
"$$\n",
138+
"\n",
139+
"Therefore, we get 2 equations we can work with:\n",
140+
"\n",
141+
"$$\n",
142+
"\\begin{align}\n",
143+
" a &= R\\cos(A) \\\\\n",
144+
" b &= R\\sin(A)\n",
145+
"\\end{align}\n",
146+
"$$"
147+
]
148+
},
149+
{
150+
"cell_type": "markdown",
151+
"id": "85684cec-5f4a-4b73-b9a7-9e129e521f4c",
152+
"metadata": {},
153+
"source": [
154+
"# Solving for **A** and **R**\n",
155+
"\n",
156+
"We want to solve for $A$ and $R$ such that we can complete the unifying formula.\n",
157+
"\n",
158+
"\n",
159+
"## Solving for **A**\n",
160+
"\n",
161+
"From the 2 equations, we can find $A$ by combining $\\sin$ and $\\cos$ into $\\tan$:\n",
162+
"\n",
163+
"$$\n",
164+
"\\frac{b}{a} = \\frac{\\cancel{R}\\sin(A)}{\\cancel{R}\\cos(A)} = \\tan(A).\n",
165+
"$$\n",
166+
"\n",
167+
"And then by taking the inverse:\n",
168+
"\n",
169+
"$$\n",
170+
"\\boxed{\n",
171+
" A = \\arctan\\left(\\frac{b}{a}\\right)\n",
172+
"}\n",
173+
"$$\n",
174+
"\n",
175+
"- For $\\arctan$, it actually has an infinite domain, so no restrictions here\n",
176+
"- It is not like $\\arcsin$ or $\\arccos$, where there is an inclusive domain\n",
177+
"- Or $\\text{arcsec}$ and $\\text{arccsc}$, where there is an exclusive domain\n",
178+
"- Also notice we could have used $\\cot$ as well in the first place, and then use $\\text{arccot}$\n",
179+
"\n",
180+
"$$\n",
181+
"\\textcolor{lightgray}{\n",
182+
" \\boxed{\n",
183+
" A = \\text{arccot} \\left(\\frac{a}{b}\\right)\n",
184+
" }\n",
185+
"}\n",
186+
"$$\n",
187+
"\n",
188+
"- But this is a matter of preference\n",
189+
"\n",
190+
"Now we have $A$, let's find $R$:\n",
191+
"\n",
192+
"## Solving for **R**\n",
193+
"\n",
194+
"Going back to the equations:\n",
195+
"\n",
196+
"$$\n",
197+
"a = R\\cos(A), \\quad b = R\\sin(A)\n",
198+
"$$\n",
199+
"\n",
200+
"We can notice that $\\sin(A)$ and $\\cos(A)$ both exist, so we can prepare it to use the Pythagorean identity:\n",
201+
"\n",
202+
"$$\n",
203+
"a^2 = R^2\\cos^2(A), \n",
204+
"\\quad \n",
205+
"b^2 = R^2\\sin^2(A)\n",
206+
"$$\n",
207+
"\n",
208+
"> **Take note here**: Because we have squared the equation, we have introduced another extraneous solution into an otherwise single-solution variable\n",
209+
"\n",
210+
"\n",
211+
"Add these together:\n",
212+
"\n",
213+
"$$\n",
214+
"a^2 + b^2 = R^2\\cos^2(A) + R^2\\sin^2(A)\n",
215+
"$$\n",
216+
"\n",
217+
"Factor out $R^2$\n",
218+
"\n",
219+
"$$\n",
220+
"a^2 + b^2 = R^2 \\biggr[ \\cos^2(A) + \\sin^2(A) \\biggr]\n",
221+
"$$\n",
222+
"\n",
223+
"Using the Pythagorean identity $\\cos^2(A) + \\sin^2(A) = 1$:\n",
224+
"\n",
225+
"$$\n",
226+
"a^2 + b^2 = R^2\n",
227+
"$$\n",
228+
"\n",
229+
"Take the square root:\n",
230+
"\n",
231+
"$$\n",
232+
"R = \\pm\\sqrt{a^2 + b^2}\n",
233+
"$$\n",
234+
"\n",
235+
"Thus, right now we have:\n",
236+
"\n",
237+
"$$\n",
238+
"a\\sin(x) \\pm b\\cos(x) = \n",
239+
"R\\cos(A \\mp x)\n",
240+
"$$\n",
241+
"\n",
242+
"where:\n",
243+
"\n",
244+
"$$\n",
245+
"\\boxed{\n",
246+
" A = \\arctan\\left(\\frac{b}{a}\\right)\n",
247+
"}\n",
248+
"\\quad \\quad \n",
249+
"R = \\pm\\sqrt{a^2 + b^2}\n",
250+
"$$\n"
251+
]
252+
},
253+
{
254+
"cell_type": "markdown",
255+
"id": "72997fa1-e58d-45e7-88e7-d295d9723d48",
256+
"metadata": {},
257+
"source": [
258+
"# Are There Restrictions Before $R^2 = a^2 + b^2$?\n",
259+
"\n",
260+
"Before the step $R^2 = a^2 + b^2$, there is no inherent restriction that forces $R$ to be positive. The square root function $\\sqrt{a^2 + b^2}$ is defined as the **non-negative root**, but the $\\pm$ arises because squaring both sides of an equation introduces an inherent ambiguity."
261+
]
262+
},
263+
{
264+
"cell_type": "markdown",
265+
"id": "d6cb31a9-f27c-4266-89c5-14470e5d8c7d",
266+
"metadata": {},
267+
"source": [
268+
"# Resolving the Ambiguity in $R$\n",
269+
"\n",
270+
"Notice that we still have ambiguity at $R$, where we can only choose one answer or the other. But let’s dig further:\n",
271+
"\n",
272+
"$$\n",
273+
"R = \\pm\\sqrt{a^2 + b^2}.\n",
274+
"$$\n",
275+
"\n",
276+
"Substituting both cases into our unified equation, we get:\n",
277+
"\n",
278+
"$$\n",
279+
"R\\cos(A \\mp x) \\quad \\text{ and } \\quad -R\\cos(A \\mp x).\n",
280+
"$$\n",
281+
"\n",
282+
"Zooming in on the second case, we can distribute the negative sign on $\\cos$:\n",
283+
"\n",
284+
"$$\n",
285+
"-R\\cos(A \\mp x) = R \\cdot -\\cos(A \\mp x)\n",
286+
"$$\n",
287+
"\n",
288+
"Using the trigonometric identity:\n",
289+
"\n",
290+
"$$\n",
291+
"-\\cos(\\theta) = \\cos(\\theta + \\pi)\n",
292+
"$$\n",
293+
"\n",
294+
"We can rewrite this as:\n",
295+
"\n",
296+
"$$\n",
297+
"R \\cdot -\\cos(A \\mp x) = R \\cos(A \\mp x + \\pi).\n",
298+
"$$\n",
299+
"\n",
300+
"$$\n",
301+
"R \\cdot -\\cos(A \\mp x) = R \\cos((A + \\pi) \\mp x).\n",
302+
"$$\n",
303+
"\n",
304+
"Now notice that $A$ has a period of $\\pi$, meaning:\n",
305+
"\n",
306+
"$$\n",
307+
"A + \\pi \\quad \\text{is functionally equivalent to} \\quad A.\n",
308+
"$$\n",
309+
"\n",
310+
"And thus\n",
311+
"\n",
312+
"$$\n",
313+
"R\\cos(A \\mp x + \\pi) = R\\cos(A \\mp x).\n",
314+
"$$\n",
315+
"\n",
316+
"We have rephrased the form with negative R, into the form with positive R\n",
317+
"- Hence, we can always take just the positive part of R\n",
318+
"\n",
319+
"$$\n",
320+
"\\boxed{\n",
321+
" R = \\sqrt{a^2 + b^2}\n",
322+
"}\n",
323+
"$$"
324+
]
325+
},
326+
{
327+
"cell_type": "markdown",
328+
"id": "7e70ea64-b61f-49e0-878d-655dbc539641",
329+
"metadata": {},
330+
"source": [
331+
"# Final Formula\n",
332+
"\n",
333+
"Thus, the R-formula for $a\\cos(x) \\pm b\\sin(x)$ is:\n",
334+
"\n",
335+
"$$\n",
336+
"a\\cos(x) \\pm b\\sin(x) = R\\cos(A \\mp x)\n",
337+
"$$\n",
338+
"\n",
339+
"where:\n",
340+
"\n",
341+
"$$\n",
342+
"A = \\arctan\\left(\\frac{b}{a}\\right), \\quad R = \\sqrt{a^2 + b^2}\n",
343+
"$$\n"
344+
]
345+
},
346+
{
347+
"cell_type": "markdown",
348+
"id": "5e1b6cc7-fdd7-489a-b854-ef1e9e5a524c",
349+
"metadata": {},
350+
"source": [
351+
"---\n",
352+
"### We can use the same logic to set up $a\\sin(x) \\pm b\\cos(x)$\n",
353+
"---"
354+
]
355+
}
356+
],
357+
"metadata": {
358+
"kernelspec": {
359+
"display_name": "Python 3 (ipykernel)",
360+
"language": "python",
361+
"name": "python3"
362+
},
363+
"language_info": {
364+
"codemirror_mode": {
365+
"name": "ipython",
366+
"version": 3
367+
},
368+
"file_extension": ".py",
369+
"mimetype": "text/x-python",
370+
"name": "python",
371+
"nbconvert_exporter": "python",
372+
"pygments_lexer": "ipython3",
373+
"version": "3.12.9"
374+
}
375+
},
376+
"nbformat": 4,
377+
"nbformat_minor": 5
378+
}

0 commit comments

Comments
 (0)