Repository: mphowardlab/essential-math
Pull request #233: L'Hopital's rule
Author: login: ella-ortbals
Created: 2025-05-06T15:03:02Z | Merged: 2025-05-09T16:20:33Z

# Add introduction and completed first draft with examples


Resolves #190

## Checklist

- [ ] New pages are added to the table of contents.
- [ ] Everything displays correctly in the web-generated preview.
- [ ] Appropriate attribution has been given to source materials.
- [ ] My name is included alphabetically in `credits.md`.


Linked issue #190: L'Hopital's rule
### Summary

Please create a new file `calculus/lhopitals-rule.md` and add these notes there:

[Download notes](https://github.com/user-attachments/files/19917442/101.pdf)

You will also need to add this file to `_toc.yml`. Let me know if you are unsure how to do those steps and we can help!

### Section

Calculus
Linked issue comments: user: login: mphoward
created_at: 2025-05-06T14:42:34Z
body: Please try to open a pull request for this issue by Wednesday May 7 to ensure there is time to review it and give you credit!
author_association: CONTRIBUTOR
user: login: ella-ortbals
created_at: 2025-05-06T15:10:50Z
body: Hello, I seem to be experiencing an issue with my branch. I have completed all the coding; however, when I requested a pull request and clicked on the preview link, it said the page could not be found. Please let me know how I should fix this problem. 

Thank you!
author_association: CONTRIBUTOR
user: login: mphoward
created_at: 2025-05-06T15:34:16Z
body: It looks like it's there now!

https://mphowardlab.github.io/essential-math/preview/pr-233/
author_association: CONTRIBUTOR
user: login: ella-ortbals
created_at: 2025-05-06T15:42:40Z
body: My file for L'Hopital Rule does not appear in the preview under the Calculus section.
author_association: CONTRIBUTOR
user: login: mphoward
created_at: 2025-05-06T15:53:43Z
body: Did you add your new file to `_toc.yml`? You should be able to copy paste one of the existing items in the list, and change the file name to add yours.
author_association: CONTRIBUTOR
user: login: ella-ortbals
created_at: 2025-05-07T01:38:00Z
body: I copy and pasted one of the existing items, but it still shows that it is "remote" when I try to make a pull request. Are you available anytime on Wednesday for me to stop by your office in order to figure out the issue? I have everything coded, I just need to figure out why my file is not showing up. 

Thank you!
author_association: CONTRIBUTOR

Diff:
diff --git a/_toc.yml b/_toc.yml
index 634027eb2..841bd5e36 100644
--- a/_toc.yml
+++ b/_toc.yml
@@ -9,6 +9,7 @@ chapters:
       - file: calculus/limits
       - file: calculus/derivatives
       - file: calculus/derivative-rules
+      - file: calculus/lhopitals-rule
       - file: calculus/series-expansion
       - file: calculus/integration
       - file: calculus/integration-substitution
diff --git a/calculus/lhopitals-rule.md b/calculus/lhopitals-rule.md
new file mode 100644
index 000000000..d85a98622
--- /dev/null
+++ b/calculus/lhopitals-rule.md
@@ -0,0 +1,86 @@
+# L'Hôpital's Rule
+
+L'Hôpital's rule is a method that allows you to calculate limits of certain
+indeterminate forms using derivatives.
+
+```{topic} L'Hôpital's Rule
+
+If $\lim_{x\to a} f(x) = \lim_{x \to a} g(x) = 0$ or $\pm \infty$, then
+
+\begin{equation}
+\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}
+\end{equation}
+
+This process can be repeated until the above situation no longer applies or
+the limit is found not to exist.
+```
+
+Let's work some examples:
+
+1. $\displaystyle \lim_{x\to 0} \frac{\sin x}{x}$
+
+   The limits of the numerator and denominator are both zero, so:
+
+   \begin{equation}
+   \lim_{x\to 0} \frac{\sin x}{x} = \lim_{x\to 0} \frac{\cos x}{1} = 1
+   \end{equation}
+
+2. $\displaystyle \lim_{x\to 0} \frac{x-\sin x}{x^3}$
+
+   The limits of the numerator and denominator are both zero, so:
+
+   \begin{align}
+   \lim_{x\to 0} \frac{x-\sin x}{x^3}
+     &= \lim_{x\to 0} \frac{1-\cos x}{3x^2} \\
+     &= \lim_{x\to 0} \frac{\sin x}{6x} \\
+     &= \frac{1}{6} \lim_{x\to 0} \frac{\sin x}{x} = \frac{1}{6}
+   \end{align}
+
+   where we used L'Hôpital's rule twice, then used the result from the first
+   example.
+
+3. $\displaystyle \lim_{x\to \infty} \frac{\ln(x)}{2\sqrt{x}}$
+
+   The limits of the numerator and denominator are both $\infty$, so:
+
+   \begin{align}
+   \lim_{x\to \infty} \frac{\ln x}{2\sqrt{x}}
+     &= \lim_{x\to \infty} \frac{1/x}{1/\sqrt{x}} \\
+     &= \lim_{x\to \infty} \frac{1}{\sqrt{x}} = 0
+   \end{align}
+
+   where the last limit is obtained by simplification.
+
+4. $\displaystyle \lim_{x\to \infty} \frac{e^x}{x^2}$
+
+   The limits of the numerator and denominator are both $\infty$, so:
+
+   \begin{align}
+   \lim_{x\to \infty} \frac{e^x}{x^2}
+   &= \lim_{x\to \infty} \frac{e^x}{2x} \\
+   &= \lim_{x\to \infty} \frac{e^x}{2} = \infty
+   \end{align}
+
+   Here, we used L'Hôpital's rule twice, but then ultimately found that the
+   limit does not exist.
+
+5. $\displaystyle \lim_{x\to \infty} x\sin(1/x)$
+
+   This limit is not in a form that's immediately suitable for L'Hôpital's rule,
+   but it can be made so.
+
+   \begin{align}
+   \lim_{x\to \infty} x\sin(1/x)
+   &= \lim_{x\to \infty} \frac{\sin(1/x)}{1/x} \\
+   &= \lim_{x\to \infty} \frac{\cos(1/x)(-1/x^2)}{-1/x^2} \\
+   &= \lim_{x\to \infty} \cos(1/x) = 1
+   \end{align}
+
+   Another option in this case would be to substitute in $y = 1/x$, then note
+   that $y \to 0$ as $x \to \infty$ so we have
+
+   \begin{equation}
+   \lim_{y\to 0} \frac{\sin y}{y} = 1
+   \end{equation}
+
+   which we already solved!


Reviews:
user: login: jinnyjc
body: Thank you - nice work! There are a few formatting issues, so I've left some suggestions. Could you take a look and apply similar changes? For the example section, I think it will be cleaner if you format it like this:

````
1. Example 1
   <solutions>

2. example 2
   <solution>
````

Also, use `\cos` and `\sin` instead of `cos` and `sin`. When it's a single equation, you can just use `\begin{equation}` instead of `\begin{align}`. Once you make the changes, please check the formatting and look for any typos, then request a final review from Dr. Howard.
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T20:20:41Z
user: login: mphoward
body: Looks great, thanks!
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T16:19:52Z

Review comments:
diff_hunk: @@ -0,0 +1,95 @@
+
+## L'Hopital's Rule
+
+This method allows you to calculate limits of certain forms using derivatives.
+
+\begin{align}
+\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}
+\end{align}
+
+Two scenarios can occur: 
+1. If f(a) = g(a) = 0, then the limit becomes $\frac{0}{0}$ 
+2. iIf f(a) $\to\pm\infty$ and g(a) $\to\pm\infty$ as x $\to$ a, then $\frac{\infty}{\infty}$
+
+In order to fix this problem, differentate the numerator and denominator until the above situations no longer apply.
+
+We will consider some example of how to use this method to solve limits. 
+
path: calculus/lhopitals-rule.md
user: login: jinnyjc
body: For key concepts or rules, I suggest wrapping them in ` ```{topic}` blocks to make them stand out.

````
L'Hopital's rule is a method to calculate limits of certain forms using derivatives.

```{topic} L'Hopital's Rule

\begin{equation}
\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}
\end{equation}

if:
- $f(a) = g(a) = 0$, then the limit becomes $\frac{0}{0}$
- $f(a) \to\pm\infty$ and $g(a) \to\pm\infty$ as $x \to a$, then $\frac{\infty}{\infty}$
```

We keep differentiating numerator and denominator until the above situations no longer apply.
````
created_at: 2025-05-08T19:55:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,95 @@
+
+## L'Hopital's Rule
+
+This method allows you to calculate limits of certain forms using derivatives.
+
+\begin{align}
+\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}
+\end{align}
+
+Two scenarios can occur: 
+1. If f(a) = g(a) = 0, then the limit becomes $\frac{0}{0}$ 
+2. iIf f(a) $\to\pm\infty$ and g(a) $\to\pm\infty$ as x $\to$ a, then $\frac{\infty}{\infty}$
+
+In order to fix this problem, differentate the numerator and denominator until the above situations no longer apply.
+
+We will consider some example of how to use this method to solve limits. 
+
+
+## Examples
+
+To solve: 
+
+\begin{align}
+\lim_{x\to 0} \frac{sin(x)}{x} = \frac{0}{0}
+\end{align}
+
+Differentiate the numerator and denominator:
+
+\begin{align}
+\lim_{x\to 0} \frac{cos(x)}{1} = cos(0) = 1
+\end{align}
+
+***
path: calculus/lhopitals-rule.md
user: login: jinnyjc
body: Since there are multiple examples, I would format it like this:

```suggestion
1. $\lim_{x\to 0} \frac{\sin(x)}{x}$

   \begin{align}
   \lim_{x\to 0} \frac{\sin(x)}{x} &= \frac{0}{0} \\
   \lim_{x\to 0} \frac{\cos(x)}{1} &= \cos(0) = 1
   \end{align}
```
created_at: 2025-05-08T20:07:42Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,95 @@
+
+## L'Hopital's Rule
+
+This method allows you to calculate limits of certain forms using derivatives.
+
+\begin{align}
+\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}
+\end{align}
+
+Two scenarios can occur: 
+1. If f(a) = g(a) = 0, then the limit becomes $\frac{0}{0}$ 
+2. iIf f(a) $\to\pm\infty$ and g(a) $\to\pm\infty$ as x $\to$ a, then $\frac{\infty}{\infty}$
+
+In order to fix this problem, differentate the numerator and denominator until the above situations no longer apply.
+
+We will consider some example of how to use this method to solve limits. 
+
+
+## Examples
+
+To solve: 
+
+\begin{align}
+\lim_{x\to 0} \frac{sin(x)}{x} = \frac{0}{0}
+\end{align}
+
+Differentiate the numerator and denominator:
+
+\begin{align}
+\lim_{x\to 0} \frac{cos(x)}{1} = cos(0) = 1
+\end{align}
+
+***
+
+To solve:
+
+\begin{align}
+\lim_{x\to 0} \frac{x-sin(x)}{x^3} = \frac{0}{0}
+\end{align}
+
+Differentiate the numerator and denominator until $\frac{0}{0}$ does not occur:
+
+\begin{align}
+\lim_{x\to 0} \frac{1-cos(x)}{3x^2} = \frac{0}{0}
+\end{align}
+
+\begin{align}
+\lim_{x\to 0} \frac{sin(x)}{6x} = \frac{1}{6}
+\end{align}
+
+***
+
+To solve:
+
+\begin{align}
+\lim_{x\to \infty} \frac{\ln(x)}{2\sqrt{x}} = \frac{\infty}{\infty}
+\end{align}
+
+Begin by differentiating the numerator and denominator until $\frac{\infty}{\infty}$ does not occur:
+
+\begin{align}
+\lim_{x\to \infty} \frac{1/x}{1/\sqrt{x}} = \frac{\infty}{\infty}\\
+\lim_{x\to \infty} \frac{1}{\sqrt{x}} = 0
+\end{align}
+
+***
+
+To solve:
+
+\begin{align}
+\lim_{x\to \infty} \frac{e^x}{x^2} = \frac{\infty}{\infty}
+\end{align}
+
+Begin by differentiating the numerator and denominator until $\frac{\infty}{\infty}$ does not occur:
+
+\begin{align}
+\lim_{x\to \infty} \frac{e^x}{2x} = \frac{\infty}{\infty} \\
+\lim_{x\to \infty} \frac{e^x}{2} = \infty
+\end{align}
+
+Other forms can also sometimes be made: $\frac{0}{0}$ or $\frac{\infty}{0}$.
+
+To solve:
+
+\begin{align}
+\lim_{x\to \infty} xsin(\frac{1}{x}) = \infty \cdot 0 \\
+\lim_{x\to \infty} \frac{\frac{sin}{x}}{\frac{1}{x}} = \frac{0}{0} \\
+\lim_{x\to \infty} \frac{cos(\frac{1}{x})\frac{-1}{x^2}}{\frac{-1}{x^2}} = 1 \\
+\end{align}
+
+Another option to solve this problem to substitute in $y=\frac{1}{x}$:
+
+\begin{align}
+\lim_{y\to 0} \frac{sin(y)}{y} = 1
+\end{align}
path: calculus/lhopitals-rule.md
user: login: jinnyjc
body: Could you apply the similar changes? Also, use `\cos` and `\sin` instead of `cos` and `sin`.

created_at: 2025-05-08T20:11:26Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,95 @@
+
+## L'Hopital's Rule
+
+This method allows you to calculate limits of certain forms using derivatives.
+
+\begin{align}
+\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}
+\end{align}
+
+Two scenarios can occur: 
+1. If f(a) = g(a) = 0, then the limit becomes $\frac{0}{0}$ 
+2. iIf f(a) $\to\pm\infty$ and g(a) $\to\pm\infty$ as x $\to$ a, then $\frac{\infty}{\infty}$
+
+In order to fix this problem, differentate the numerator and denominator until the above situations no longer apply.
+
+We will consider some example of how to use this method to solve limits. 
+
+
+## Examples
+
+To solve: 
+
+\begin{align}
+\lim_{x\to 0} \frac{sin(x)}{x} = \frac{0}{0}
+\end{align}
+
+Differentiate the numerator and denominator:
+
+\begin{align}
+\lim_{x\to 0} \frac{cos(x)}{1} = cos(0) = 1
+\end{align}
+
+***
+
+To solve:
+
+\begin{align}
+\lim_{x\to 0} \frac{x-sin(x)}{x^3} = \frac{0}{0}
+\end{align}
+
+Differentiate the numerator and denominator until $\frac{0}{0}$ does not occur:
+
+\begin{align}
+\lim_{x\to 0} \frac{1-cos(x)}{3x^2} = \frac{0}{0}
+\end{align}
+
+\begin{align}
+\lim_{x\to 0} \frac{sin(x)}{6x} = \frac{1}{6}
+\end{align}
+
+***
+
+To solve:
+
+\begin{align}
+\lim_{x\to \infty} \frac{\ln(x)}{2\sqrt{x}} = \frac{\infty}{\infty}
+\end{align}
+
+Begin by differentiating the numerator and denominator until $\frac{\infty}{\infty}$ does not occur:
+
+\begin{align}
+\lim_{x\to \infty} \frac{1/x}{1/\sqrt{x}} = \frac{\infty}{\infty}\\
+\lim_{x\to \infty} \frac{1}{\sqrt{x}} = 0
+\end{align}
+
+***
+
+To solve:
+
+\begin{align}
+\lim_{x\to \infty} \frac{e^x}{x^2} = \frac{\infty}{\infty}
+\end{align}
+
+Begin by differentiating the numerator and denominator until $\frac{\infty}{\infty}$ does not occur:
+
+\begin{align}
+\lim_{x\to \infty} \frac{e^x}{2x} = \frac{\infty}{\infty} \\
+\lim_{x\to \infty} \frac{e^x}{2} = \infty
+\end{align}
+
+Other forms can also sometimes be made: $\frac{0}{0}$ or $\frac{\infty}{0}$.
+
+To solve:
+
+\begin{align}
+\lim_{x\to \infty} xsin(\frac{1}{x}) = \infty \cdot 0 \\
+\lim_{x\to \infty} \frac{\frac{sin}{x}}{\frac{1}{x}} = \frac{0}{0} \\
path: calculus/lhopitals-rule.md
user: login: jinnyjc
body: Typo here

```suggestion
\lim_{x\to \infty} \frac{\sin({\frac{1}{x}})}{\frac{1}{x}} = \frac{0}{0}
```
created_at: 2025-05-08T20:13:25Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-05-06T15:03:43Z
body: [PR Preview Action](https://github.com/rossjrw/pr-preview-action) v1.6.1
:---:
Preview removed because the pull request was closed.
2025-05-09 16:20 UTC
<!-- Sticky Pull Request Commentpr-preview -->
author_association: NONE
user: login: mphoward
created_at: 2025-05-07T02:08:09Z
body: This should be fixed to show a preview now! You were missing the entry in `_toc.yml`.

https://mphowardlab.github.io/essential-math/preview/pr-233/calculus/lhopitals-rule.html
author_association: CONTRIBUTOR
user: login: mphoward
created_at: 2025-05-07T20:30:42Z
body: @ella-ortbals please make sure to finalize your work and request a review ASAP to receive credit.
author_association: CONTRIBUTOR
user: login: ella-ortbals
created_at: 2025-05-07T20:46:39Z
body: Thank you for your help! I just submitted a review. 
author_association: CONTRIBUTOR