Writing Calculus Tests with ChatGPT
Last week I talked about the new chatbots, like ChatGPT and Bing’s chat interface. I argued that they while they produce language they can’t really analyze it or check it for errors; and that this is a meaningful restriction that we can’t get past without a serious change in the approach we take to AI systems. So the chatbots won’t be able to fully replace intellectual labor any time soon. But they still might help, especially if we can identify formulaic tasks that don’t require really critically thinking about how ideas connect.
But rather than philosophizing, I decided to get concrete about this. Can I use ChatGPT to make my job easier? It’s going to be pretty useless for the most important parts of my job. In particular, it has no way to figure out why a student is confused and address their confusions. And it’s not going to come up with insightful new ways to describe course topics. It won’t even be able to meaningfully connect distinct ideas in the course, because it has no sense of what’s already been covered.
Instead I need to find the aspects of my job that are routine, and involve following relatively standard templates and filling them out in predictable ways. I need to find tasks that it’s easy for me to check if they’re done right, since ChatGPT is not correct with any consistency. Ideally, I’d also find ways to have it replace the parts of my job that are the most annoying: I don’t want a way to avoid spending time in office hours with students, because office hours are fun!
But one thing I spend a lot of time doing, and don’t enjoy at all, is writing homework and test questions. I need to create original problems (or at least ones that aren’t in the textbook so students can’t look them up), but not too original (so they fit the patterns that my calculus students are supposed to be learning). And unlike all of the rest of my course planning, I need to do new ones every year—I can reuse my old lecture notes, but it’s not safe to reuse my old tests.
So I decided to spend some time experimenting with GPT as a test writer. Can it write good questions? Can it write usable solutions for those questions? And can it do this easily, or is shepherding it through the process more trouble than it’s worth?
But before I tell you what I found, I want to mention that if you want to support my writing, I now have a KoFi account. Any tips would be appreciated and would help me write more essays like this.
The Verdict
Overall, the current tech is seems somewhat useful, but not actually good—at least, not yet. But it’s close enough that I suspect it will get pretty good for this purpose before long.
Writing Problems
With a couple exceptions, ChatGPT could figure out what type of question I was asking for. If I asked for a related rates problem, or an integration problem that involved integration by parts, I would get one. Sometimes they weren’t quite right, but I could get the general type of problem I asked for, with basically no prompt engineering.
On the other hand, it was hard to get specifics. I can get a big pile of integration by parts problems, but a lot of them will be either very easy or very hard. And ChatGPT gets stuck in ruts; I saw identical problems show up to multiple different prompts, and there were running themes in everything it output. That means that the system can’t give me finetuned answers, and also will not give me an even coverage of the relevant types of problems.
But if I have something specific I want, I can probably just write it myself; and even if it won’t give me every type of problem, it can help remind me of my options. I found it genuinely useful for brainstorming problems, even if I didn’t use any of them exactly. (And I am at this moment proctoring a test that includes some problems I wrote with GPT assistance.)
Solving Problems
On the other hand, the solutions it produced were usually wrong, sometimes spectacularly so. A few times I got a completely correct solution. Most of the time, I would get an answer that had the right approach but did completely nonsensical calculations in the middle; the solutions would look superficially correct, but checking them carefully turned up multiple errors. And occasionally I would get arguments almost completely unrelated to the questions I asked.
But, if anyone does figure out a way to usefully and consistently hook this up to a computer algebra system, it will probably do pretty well at solving problems too. It tended to set up the right computation and then generate a nonsense answer; if it could tell when it needs to just factor a polynomial or compute an integral, and pass that to a computer algebra system, that would fix a lot of the weaknesses.
I know multiple teams are trying to find a way to hook systems like GPT up to computational engines and computer algebra systems. If they could do that effectively it would probably be able to write good solutions immediately, but that really sounds nontrivial to me. You could maybe teach it to pass integrals or other specific calculations to a computer algebra system, read the result, and print the result. But translating that into a wellwritten solution solution would require some sort of deep integration of the two capabilities, not just an ability to print the final answer.
But one thing did impress me about the solutions: ChatGPT could clearly consistently remember what question it was trying to answer. Every single solution ended with a clear restatement of the question and an answer to it. The answer was usually wrong but it never lost track of what it was supposed to be answering. (And that’s more than I can say for some of my students.) This mostly shows that the question is still in ChatGPT’s context window when it finishes the solution, but also that it’s still using the details of the question. And it’s doing that consistently; I don’t think it failed at this once.
Other Observations
ChatGPT can write perfectly valid and idiomatic LaTeX code, which I was mildly surprised by. I’m used to the fact that it can put out grammatical and idiomatic English text, but I was still impressed by the LaTeX.
Similarly, ChatGPT can draw diagrams using ASCII art. I’m really curious how much of that was in the training set; I wouldn’t have thought it was that common, but it’s clearly common enough. (It did not always accurately describe the diagram it had drawn.)
One major weakness is that ChatGPT doesn’t have a consistent style. Each solution it wrote used completely different notation and phrasing—even when I asked it to respond to the same prompt multiple times.
The Data
The rest of this post is a record of things I tried and experiments I conducted in getting ChatGPT to write calculus questions for me. I spent a while playing around, and tried to include everything here as a sort of lab notebook and complete record. If you don’t need to write calculus questions you probably don’t want to read the whole thing.
But I have hidden most of the long GPT exchanges under pulldown spoiler boxes. If you just want to skim through and see my thoughts on each experiment, you can do that; and you can expand out any box you decide you actually want to read.
Or you can jump to the end and leave me a comment.
Max/Min problems
When I teach calculus 1, my absolute least favorite thing to do is writing test questions for max/min problems. It’s simultaneously extremely routine and extremely tedious. So I decided to start there.
Max/Min take one
Prompt: Write a problem where you have to classify the critical points of a function, with a solution.
Response 1
Problem:
Consider the function $f(x) = x^3  3x^2 + x  1$. Determine the critical points of the function and classify them as local maxima, local minima, or inflection points.
Solution:
A critical point of a function is a point where the derivative of the function is equal to zero or is undefined. To find the critical points of the function, we first find its first derivative:
$f’(x) = 3x^2  6x + 1$
Setting $f’(x) = 0$, we find the critical points:
$3x^2  6x + 1 = 0$
$x = \frac{6 \pm \sqrt{36  4 \cdot 3 \cdot 1}}{2 \cdot 3} = \frac{3 \pm \sqrt{3}}{3}$
Let $c_1 = \frac{3 + \sqrt{3}}{3}$ and $c_2 = \frac{3  \sqrt{3}}{3}$. These are the critical points of the function. To classify them, we need to find the second derivative and check the sign of the second derivative at each critical point. The second derivative of the function is:
$f’‘(x) = 6x  6$
At $c_1$, the second derivative is $6c_1  6 = 6(\frac{3 + \sqrt{3}}{3})  6 = 6$, which is positive. This means that $f(c_1)$ is a local minimum.
At $c_2$, the second derivative is $6c_2  6 = 6(\frac{3  \sqrt{3}}{3})  6 = 6$, which is negative. This means that $f(c_2)$ is a local maximum.
Therefore, the critical points of the function $f(x) = x^3  3x^2 + x  1$ are:
$c_1 = \frac{3 + \sqrt{3}}{3}$, which is a local minimum.
$c_2 = \frac{3  \sqrt{3}}{3}$, which is a local maximum.
Response 2
Problem: Consider the function $f(x) = x^3  6x^2 + 9x  2$. Classify the critical points of the function as relative maxima, relative minima, or inflection points.
Solution: To classify the critical points, we need to find the critical points and then determine their behavior using the second derivative test.
Finding critical points: To find the critical points, we need to find the points where the first derivative of the function is equal to zero or the first derivative does not exist. The first derivative of the function is given by: $f’(x) = 3x^2  12x + 9$
Setting $f’(x) = 0$, we find that:
$3x^2  12x + 9 = 0$
Solving for $x$, we get the critical points:
$x = \frac{12 \pm \sqrt{12^2  4 \cdot 3 \cdot 9}}{2 \cdot 3}$
$x = \frac{12 \pm \sqrt{144  108}}{6}$
$x = \frac{12 \pm \sqrt{36}}{6}$
$x = \frac{12 \pm 6}{6}$
$x = 3, 1$
So, the critical points are $x = 1, 3$.
Second derivative test: To determine the behavior of the critical points, we use the second derivative test. We find the second derivative of the function and evaluate it at the critical points: $f’‘(x) = 6x  12$
$f’‘(1) = 6 \cdot 1  12 = 6$
$f’‘(3) = 6 \cdot 3  12 = 0$
Since $f’‘(1) < 0$, it means that $x = 1$ is a relative maximum. Since $f’‘(3) = 0$, it means that $x = 3$ is an inflection point.
So, the critical points are:
$x = 1$ is a relative maximum
$x = 3$ is an inflection point.
There are a couple things to notice here. First, I did no postprocessing on the output at all. ChatGPT wrote perfectly formatted LaTeX code for these answers without me editing it at all.^{1}
Second is that these are both fairly simple problems. My next step is going to have to be seeing if I can get more interesting examples out of it; it went for a simple cubic both times.
Third is that the solution style is inconsistent. ChatGPT doesn’t write up solutions the way I would, which is to be expected. But it also doesn’t write them up the same way as itself. The two solutions use different notations and different phrasings. This doesn’t make it wrong, but it isn’t great as a teaching tool; it’s good for students to see a certain amount of consistency, especially as beginners.
And fourth is that despite the nice organization and formatting, both of these solutions are almost, but not quite, right:

Response 1 takes the quadratic equation \(3x^26x+1 =0\), correctly uses the quadratic formula, and then simplifies the solutions to \( \dfrac{3 \pm \sqrt{3}}{3}\). But the actual solutions are \(\dfrac{3 \pm \sqrt{6}}{3}\).
Then when it plugs these points into the second derivative, in incorrectly computes \(\pm 6\) when it should get \(\pm 2 \sqrt{3} \).
These are the sort of basic arithmetic errors that make me think a student understands the material, but is sloppy with arithmetic; I’d probably grade this as an 8/10.

Response 2 computes the critical points correctly.
When it plugs them into the second derivative, it correctly computes \(f^{\prime \prime} (1) = 6\) but says that \(f^{\prime \prime}(3) = 6\cdot 3  12 = 0\), when of course \(6 \cdot 3  12 = 6 \).
Then it interprets this calculation wrong: it makes a key conceptual error by saying that since \(f^{\prime \prime}(3) = 0\), we know that \(3\) is an inflection point. This is kind of halfright, and I could see some mathematicians accepting that conclusion. But not all points where \(f^{\prime prime} = 0\) are inflection points, and I wouldn’t accept that conclusion.
So we get wellformatted solutions, but they’re not consistent or reliable; I’d have to handcheck them, and probably rewrite to match my style.
But I want to see if we can get better questions out of this, so let’s go back to the well.
Max/Min take 2
I wanted to get slightly more complicated functions involved.
Prompt: Write a problem where you have to classify the critical points of a rational function, with a solution.
Response 1
Problem: Consider the function $f(x) = \frac{x^33x}{x^22x+1}$. Classify the critical points of the function as relative maxima, relative minima, or inflection points.
Solution: To classify the critical points, we need to find the critical points and then determine their behavior using the second derivative test.
Finding critical points: To find the critical points, we need to find the points where the first derivative of the function is equal to zero or the first derivative does not exist. The first derivative of the function is given by: $f’(x) = \frac{(x^21)(x^23)}{(x1)^2}$
Setting $f’(x) = 0$, we find that:
$(x^21)(x^23) = 0$
Solving for $x$, we get the critical points:
$x = \pm 1, \pm\sqrt{3}$
However, $x=1$ is not a critical point since the denominator of the function is zero at $x=1$. Therefore, the critical points are $x = \sqrt{3}, 1, \sqrt{3}$.
Second derivative test: To determine the behavior of the critical points, we use the second derivative test. We find the second derivative of the function and evaluate it at the critical points: $f’‘(x) = \frac{6x(x1)(x+1)}{(x1)^3}$
$f’’(\sqrt{3}) = \frac{6\sqrt{3}}{(2\sqrt{3})^3} = \frac{3}{4\sqrt{3}}$
$f’‘(1)$ does not exist since the denominator of the second derivative is zero.
$f’’(\sqrt{3}) = \frac{6\sqrt{3}}{(2\sqrt{3})^3} = \frac{3}{4\sqrt{3}}$
Since $f’’(\sqrt{3}) < 0$, it means that $x = \sqrt{3}$ is a relative maximum. Since $f’’(\sqrt{3}) > 0$, it means that $x = \sqrt{3}$ is a relative minimum. The point $x=1$ is not a critical point since the function is undefined at that point.
So, the critical points are:
$x = \sqrt{3}$ is a relative maximum
$x = \sqrt{3}$ is a relative minimum.
Response 2
Problem: Consider the function $f(x) = \frac{x^2  6x + 9}{x^2  4}$. Classify the critical points of the function as relative maxima, relative minima, or inflection points.
Solution: To classify the critical points, we need to find the critical points and then determine their behavior using the second derivative test.
Finding critical points: To find the critical points, we need to find the points where the first derivative of the function is equal to zero or the first derivative does not exist. The first derivative of the function is given by: $f’(x) = \frac{(2x  6)(x^2  4)  (x^2  6x + 9)(2x)}{(x^2  4)^2}$
Simplifying the expression, we get:
$f’(x) = \frac{x^4 + 8x^3  5x^2  72x + 72}{(x^2  4)^2}$
Setting $f’(x) = 0$, we find that:
$x^4 + 8x^3  5x^2  72x + 72 = 0$
We can factor this expression as:
$(x  2)(x  3)(x^2  3x  12) = 0$
Solving for $x$, we get the critical points:
$x = 2, 3, \frac{3 \pm \sqrt{105}}{2}$
So, the critical points are $x = 2, 3, \frac{3  \sqrt{105}}{2}, \frac{3 + \sqrt{105}}{2}$.
Second derivative test: To determine the behavior of the critical points, we use the second derivative test. We find the second derivative of the function and evaluate it at the critical points: $f’‘(x) = \frac{2x^5  30x^4 + 144x^3  320x^2 + 288x  72}{(x^2  4)^3}$
$f’‘(2) = \frac{360}{36} = 10$
$f’‘(3) = \frac{540}{49} < 0$
$f’‘\left(\frac{3  \sqrt{105}}{2}\right) > 0$
$f’‘\left(\frac{3 + \sqrt{105}}{2}\right) < 0$
Since $f’‘(2) > 0$, it means that $x = 2$ is a relative minimum. Since $f’‘(3) < 0$, it means that $x = 3$ is a relative maximum. Since $f’‘\left(\frac{3  \sqrt{105}}{2}\right) > 0$ and $f’‘\left(\frac{3 + \sqrt{105}}{2}\right) < 0$, it means that $\frac{3  \sqrt{105}}{2}$ is an inflection point and $\frac{3 + \sqrt{105}}{2}$ is a local maximum.
So, the critical points are:
$x = 2$ is a relative minimum $x = 3$ is a relative maximum $\frac{3  \sqrt{105}}{2}$ is an inflection point $\frac{3 + \sqrt{105}}{2}$ is a local maximum.
Both of these questions are at least moderately reasonable, but the answers are wildly offbase.

Response 1 computes the derivative incorrectly, sets it equal to zero correctly, computes the second derivative incorrectly, and plugs the critical points into it incorrectly. It does draw the correct conclusions from the results of those computations, though.
It also makes a random sign error on one of the critical points, and makes a technically incorrect claim about what qualifies as a critical point. (points where the derivative is undefined are critical points but can’t be maxima or minima).

Response 2 computes the derivative correctly, but simplifies it incorrectly, then sets it equal to zero incorrectly. It computes the second derivative incorrectly, and then plugs in the critical points it computed incorrectly.
It almost interprets the computations correctly, but then fails: it claims that because \(f’’ \left( \frac{3\sqrt{105}}{2} \right) > 0 \), that point is an inflection point, which is definitely wrong.
(Also it repeats itself at the end, but that’s not wrong, just badly written.)
Overall this doesn’t seem like an awful way to brainstorm problems, but I would have to write solutions myself and confirm the problems are reasonably solvable.
Related Rates problems
Prompt: Write a related rates problem with a solution
Response 1
Problem: A spherical balloon is being inflated with air at a rate of 4 cubic feet per minute. At the instant when the radius of the balloon is 2 feet, how fast is the radius of the balloon increasing?
Solution: We can use the formula for the volume of a sphere to relate the rate of change of the volume of the balloon with the rate of change of the radius:
$V = \frac{4}{3}\pi r^3$
Taking the derivative of both sides with respect to time, we get:
$\frac{dV}{dt} = 4\pi r^2 \frac{dr}{dt}$
We are given that $\frac{dV}{dt} = 4$ cubic feet per minute, and we know that the radius of the balloon is 2 feet. So, substituting these values, we get:
$4 = 4\pi (2)^2 \frac{dr}{dt}$
Simplifying, we get:
$\frac{dr}{dt} = \frac{1}{4\pi (2)^2} = \frac{1}{16\pi}$ feet per minute
So, the radius of the balloon is increasing at a rate of $\frac{1}{16\pi}$ feet per minute when the radius of the balloon is 2 feet.
Response 2
Problem: A water tank is in the shape of a cylinder with a radius of 5 feet and a height of 10 feet. Water is flowing into the tank at a rate of 3 cubic feet per minute. How fast is the water level rising when the water is 6 feet deep?
Solution:
Let’s begin by labeling the variables we need:
$r$ is the radius of the tank, which is 5 feet. $h$ is the height of the water level in the tank. $V$ is the volume of water in the tank. $t$ is time. $dV/dt$ is the rate at which water is flowing into the tank, which is 3 cubic feet per minute. We want to find the rate of change of $h$ with respect to time when $h = 6$ feet.
To solve the problem, we need to relate $h$ and $V$. The volume of a cylinder is given by the formula:
$V = \pi r^2 h$
Differentiating with respect to time, we get:
$dV/dt = \pi r^2 dh/dt$
Solving for $dh/dt$, we get:
$dh/dt = (dV/dt)/( \pi r^2)$
Now, we need to find $dV/dt$ when $h = 6$ feet. The volume of water in the tank when the water level is 6 feet deep is:
$V = \pi r^2 h = \pi (5^2)(6) = 150\pi$
Differentiating with respect to time, we get:
$dV/dt = 150\pi (dh/dt)$
Substituting $dV/dt = 3$ and $r = 5$, we get:
$3 = 150\pi (dh/dt)$
Solving for $dh/dt$, we get:
$dh/dt = 3/(150\pi) = 0.02$ feet per minute
So, the water level is rising at a rate of 0.02 feet per minute when the water is 6 feet deep.
Response 3
Problem: A spherical balloon is being inflated at a rate of 10 cubic feet per minute. Find the rate at which the radius of the balloon is increasing when the diameter is 2 feet.
Solution:
Let’s start by writing down what we know:
The volume of a sphere is given by V = (4/3)πr^3, where r is the radius. We know that dV/dt = 10, since the balloon is being inflated at a rate of 10 cubic feet per minute. We want to find dr/dt when the diameter is 2 feet, which means r = 1 foot. To find the rate at which the radius of the balloon is increasing, we need to relate dV/dt and dr/dt using the chain rule. We have:
dV/dt = dV/dr * dr/dt
We can find dV/dr by taking the derivative of the volume formula with respect to r:
dV/dr = 4πr^2
Substituting the values we know, we get:
10 = (4/3)π(1^3) * dr/dt * 4π(1^2)
Simplifying the expression, we get:
dr/dt = 15/(2π)
So, the rate at which the radius of the balloon is increasing when the diameter is 2 feet is 15/(2π) feet per minute.

Response 1 is a simple and straightforward, but solid problem. And the solution is so close to being right. It does everything correctly up until the very end, and then it makes an arithmetic error at the end.

Response 2 Is also pretty simple, maybe too simple for me to really like it. The solution starts off strong, but halfway through gets itself confused, starts the problem over, and does it wrong.

Response 3 is also a simple problem, basically the same as Response 1. I was impressed it kept diameter versus radius straight. The solution starts out strong, but then again goes off the rails halfway through and gives a slightly wrong answer at the end.
At this point I wanted to see if I could prompt it into giving me more interesting problems. I also decided to play around with some prompt engineering ideas: what if I tell it what sort of thing it wants to achieve?
Prompt: Pretend you’re a brilliant professor who wants to write an interesting and challenging calculus test. Write a related rates problem involving similar triangles with a solution.
Response 1
Problem: A hot air balloon is rising vertically at a rate of 5 meters per second. At a certain instant, the angle of elevation between the observer on the ground and the balloon is 60 degrees. The observer is 150 meters away from the launch point of the balloon. How fast is the distance between the observer and the balloon increasing at this instant?
Solution:
Let’s start by drawing a diagram to visualize the problem:
yaml
Copy code
B (balloon)
/
/ 
/ h
/ 
/θ 
/ 
/ 
A (observer)
We have a right triangle ABC, where A is the observer, B is the balloon, and C is the point on the ground directly below the balloon. We know that AB = 150 meters, and the angle θ is 60 degrees. We want to find how fast the distance BC is changing when the balloon is rising at a rate of 5 meters per second.
We can see that triangles ABC and ABD are similar, so we can use the property of similar triangles to relate the sides:
AB/AC = BD/BC
Simplifying the expression, we get:
BC = (AB*BD)/AC
To find BD, we need to use trigonometry. We have:
tan θ = BD/AC
Substituting the known values, we get:
tan 60 = BD/AC
sqrt(3) = BD/AC
BD = sqrt(3) * AC
Now, we can substitute this value into the equation we derived earlier:
BC = (AB*sqrt(3)*AC)/AC
Simplifying the expression, we get:
BC = 150*sqrt(3)
Now, we need to find how fast BC is changing with respect to time. We have:
dBC/dt = d/dt (150*sqrt(3))
dBC/dt = 0 (since 150*sqrt(3) is a constant)
Therefore, the distance between the observer and the balloon is not changing at this instant, and its rate of change is zero.
Response 2
Problem: A flagpole standing vertically on a hill has a height of 20 feet and is located on a slope with an inclination of 30 degrees. A person standing on the same slope 100 feet away from the base of the flagpole observes that the angle of elevation to the top of the flagpole is increasing at a rate of 0.1 radians per minute. At what rate is the person moving closer to the flagpole at the moment when the angle of elevation is 60 degrees?
Solution:
Let’s start by drawing a diagram of the situation:
perl
Copy code
/
/ 
/  20 ft
/ 
/ 
/ 
/\
100 ft
In the diagram, the flagpole has height 20 feet and is located on a slope with inclination 30 degrees. The person is standing on the same slope 100 feet away from the base of the flagpole and observes that the angle of elevation to the top of the flagpole is increasing at a rate of 0.1 radians per minute.
Let’s define some variables:
Let x be the distance between the person and the base of the flagpole. Let y be the height of the person’s eye above the ground. Let θ be the angle of elevation to the top of the flagpole. From the diagram, we can see that the triangles formed by the person, the flagpole, and the ground are similar. Therefore, we have:
y / x = (20 + y) / (x / cos 30)
Simplifying this equation, we get:
y = 20x / (2x + sqrt(3)x)
We want to find the rate at which the person is moving closer to the flagpole at the moment when the angle of elevation is 60 degrees, which means θ = π/3 radians. We also know that dθ/dt = 0.1 radians per minute.
Using trigonometry, we can relate θ and y:
tan θ = (20 + y) / x
Taking the derivative with respect to time, we get:
sec^2 θ * dθ/dt = (dy/dt * x  y * dx/dt) / x^2
Substituting the values we know, we get:
1/3 * dθ/dt = (dy/dt * 100  y * dx/dt) / 10000
We want to find dx/dt when θ = π/3 and dθ/dt = 0.1. We can use the equation y = 20x / (2x + sqrt(3)x) to eliminate y:
1/3 * 0.1 = (dy/dt * 100  (20x / (2x + sqrt(3)x)) * dx/dt) / 10000
Simplifying the expression and solving for dx/dt, we get:
dx/dt = 0.1429 feet per minute
So, the person is moving closer to the flagpole at a rate of 0.1429 feet per minute when the angle of elevation is 60 degrees.

Response 1 certainly gives a much more challenging problem than the previous prompt ever did! And the fact that it can draw a diagram of the problem in ASCII art is really cool, although not terribly helpful.
But ChatGPT gets confused as soon as it starts writing the solution: it can’t keep track of which points A, B, and C we want to talk about. Then it compares the triangle ABC it sketched out to a similar triangle ABD, which doesn’t actually exist in the problem or the diagram.
From there it continues to be kind of incoherent. It has \(\tan(\theta) = BD/AC\), which should be pieces of different triangles, so that doesn’t make much sense. And it concludes with making one of the key basic errors that calc 1 students make: plugging in values before taking the derivative, so that your derivatives all wind up being zero.
(This is also the first time I had to do editing to make the formatting work, but I’m not holding that against ChatGPT; it rendered fine in the GPT window, but my site messed around with it a bit.)

Response 2 is a problem that is hard enough that I’d struggle with it. It’s interesting, but I can’t assign it!
The solution makes things worse by introducing additional considerations (like the height of the person’s eye above the ground!). It declares that three triangles are all similar, without being clear on what those triangles are, and I’m pretty sure this problem has no similar triangles at all.
After that detour it does some correctish work, but makes the usual algebra errors, and then falls back on the weird notsimilartriangles argument from earlier.
Okay, let’s give up on the prompt engineering, and see what happens if we just ask for a normal similar triangles problem.
Prompt: Write a related rates problem involving similar triangles with a solution.
Response 1
Problem: A person standing 10 meters away from a street light observes that the angle of elevation from their eye to the top of the light is 60 degrees. The person begins to walk away from the light at a rate of 2 meters per second. How fast is the angle of elevation changing when the person is 20 meters away from the light?
Solution:
Let’s start by drawing a diagram of the situation:
markdown
Copy code
\
 \
 \
 \
 \
 \
 \
 \
θ \ 10 m
 \
 \
 \
__________\
In the diagram, the person is standing 10 meters away from the street light and observes that the angle of elevation from their eye to the top of the light is 60 degrees. The person begins to walk away from the light at a rate of 2 meters per second.
Let’s define some variables:
Let d be the distance between the person and the light. Let θ be the angle of elevation to the top of the light. From the diagram, we can see that the triangles formed by the person, the street light, and the ground are similar. Therefore, we have:
d / 10 = tan θ
Taking the derivative with respect to time, we get:
1/10 * dd/dt = sec^2 θ * dθ/dt
We want to find dθ/dt when d = 20 meters. We also know that dd/dt = 2 meters per second.
Using trigonometry, we can relate θ and d:
tan θ = d / 10
Substituting the values we know, we get:
1/10 * 2 = sec^2 θ * dθ/dt
Simplifying the expression, we get:
dθ/dt = 1/(5sec^2 θ) radians per second
We can use the equation tan θ = d / 10 to eliminate θ:
tan θ = d / 10
sec^2 θ = 1 + tan^2 θ
Substituting these values into the expression for dθ/dt, we get:
dθ/dt = 1 / (5(1 + (d/10)^2)) radians per second
Substituting d = 20, we get:
dθ/dt = 1 / (5(1 + 4)) radians per second
Simplifying the expression, we get:
dθ/dt = 1 / 25 radians per second
So, the angle of elevation is changing at a rate of 1/25 radians per second when the person is 20 meters away from the light.
And I think we’ve conclusively shown that ChatGPT doesn’t understand what similar triangles are.
Brainstorming Related Rates Problems
At this point I’m pretty convinced that ChatGPT won’t write up good solutions. What if I just ask for problems?^{2}
Prompt: Write me some related rates problems involving distance.
Response 1
Sure! Here are a few related rates problems involving distance:

Two cars are driving towards each other on a straight road. Car A is traveling at 60 mph, and car B is traveling at 40 mph. If the distance between them is 1 mile, how fast are they getting closer to each other?

A ladder is leaning against a wall. The base of the ladder is 6 feet from the wall, and the top of the ladder is 10 feet up the wall. If the bottom of the ladder is being pulled away from the wall at a rate of 2 feet per second, how fast is the top of the ladder sliding down the wall when the base is 8 feet from the wall?

A person is standing at the edge of a cliff, looking out at the ocean. The cliff is 100 feet high. If the person’s line of sight makes an angle of 30 degrees with the horizontal, how far out from the cliff is the person looking?

A person is walking away from a lamppost at a rate of 3 feet per second. The person is initially 10 feet from the lamppost. How fast is the person’s distance from the lamppost increasing after 5 seconds?

A ball is thrown straight up into the air from a height of 5 feet, with an initial velocity of 20 feet per second. How long does it take for the ball to reach a height of 25 feet, and what is the ball’s velocity at that point?
The second suggestion is a standard but perfectly good related rates problem, but the others don’t fare nearly so well. They did all involve distance somehow, though!
 The first problem is technically a related rates problem, but it doesn’t require calculus.
 The third doesn’t involve any rates at all.
 The fourth asks about one rate, and also it just tells you what that rate is in the problem. It’s purely a reading comprehension question.
 The fifth also has one rate, but isn’t a related rates problem. It also doesn’t contain enough information to solve the problem; you would need to know the acceleration to work out the problem, and even with that it would require integrals.
The last one was the most interesting to me, in terms of how I related to it. You can plausibly do the problem if you assume acceleration under earth gravity. And I spent a bit of time trying to figure out if ChatGPT intended me to do that, and thinking about how I could get it to tell me—before realizing that asking about ChatGPT’s “intentions” is misunderstanding it. I could ask more questions and it could make a decision, but it doesn’t have a stable “what I meant” that I could try to probe.
Let’s try again.
Response 2
Sure, here are some related rates problems involving distance:

Two cars are traveling towards each other on a straight road. Car A is traveling at 60 mph and car B is traveling at 40 mph. If the distance between the two cars is initially 500 miles, how fast is the distance between them decreasing?

A ladder 10 feet long rests against a vertical wall. If the bottom of the ladder slides away from the wall at a rate of 2 feet per second, how fast is the top of the ladder sliding down the wall when the bottom of the ladder is 6 feet from the wall?

A person is walking away from a lamppost at a rate of 4 feet per second. The height of the lamppost is 20 feet. How fast is the person’s shadow lengthening when they are 25 feet from the lamppost?

A ball is thrown straight up into the air with an initial velocity of 40 feet per second. The height of the ball, h, in feet after t seconds is given by h = 40t  16t^2. How fast is the ball moving when it reaches a height of 30 feet?

Two boats are approaching each other in a straight line. One boat is traveling at a speed of 10 mph and the other is traveling at a speed of 15 mph. The boats are initially 1000 feet apart. How fast is the distance between the boats decreasing when they are 500 feet apart?
Surprisingly, the first two questions in response 2 are almost identical to the first two questions in response 1. This goaround, the third question is also a good, standard related rates problem; the fourth is a derivative word problem that doesn’t involve related rates; and the fifth is essentially the same as the first.
My conclusion: this isn’t useless, actually! With like two minutes of effort I got three usable problems. And it’s not that I couldn’t have written these problems myself, but it’s easy for me to get into decision paralysis while questionwriting. This certainly fixes the brainstorming problem, and gives me raw material to shape into what I want.
But I’m going to have to write up my own solutions.
Can it solve my problems?
Or do I? In the previous prompts, it failed to write solutions while writing problems. But I was curious what would happen if I just gave it a question and let it solve it. Will this work correctly?
A ladder is leaning against a wall. The base of the ladder is 6 feet from the wall, and the top of the ladder is 10 feet up the wall. If the bottom of the ladder is being pulled away from the wall at a rate of 2 feet per second, how fast is the top of the ladder sliding down the wall when the base is 8 feet from the wall?
Let’s start by drawing a diagram:
lua
Copy code
\
 \
 \
 \
 \
 \
 \
 \
h \
 \
 \
 \
 \
 \

d
Here, the ladder is represented by the diagonal line, with the base of the ladder represented by “d” and the height of the ladder represented by “h”. We want to find how fast the top of the ladder is sliding down the wall, which is represented by the rate of change of “h”, as the base of the ladder is being pulled away from the wall.
We can see that the distance between the top of the ladder and the wall, which we’ll call “x”, is proportional to the height of the ladder and inversely proportional to the distance between the base of the ladder and the wall:
x/d = h/10
Taking the derivative of both sides with respect to time t, we get:
(dx/dt)/d  x/(d^2)(dd/dt) = (dh/dt)/10
We want to find (dh/dt) when d = 8 feet. We are given that the base of the ladder is being pulled away from the wall at a rate of 2 feet per second, so dd/dt = 2.
When d = 8, we can use the proportion above to find x:
x/8 = 10/h
x = 80/h
We also know that d^2 + h^2 = 10^2, since the ladder is 10 feet long. When d = 6, we can use this equation to find h:
6^2 + h^2 = 10^2
h^2 = 64
h = 8
So when the base of the ladder is 6 feet from the wall, the ladder reaches a height of 8 feet on the wall.
Now we can plug in the values we have into the related rates equation:
(dx/dt)/d  x/(d^2)(dd/dt) = (dh/dt)/10
(dx/dt)/8  (80/h)/(8^2)(2) = (dh/dt)/10
We need to find (dh/dt) when d = 8 and h = 6. We can use the equation d^2 + h^2 = 10^2 to find h when d = 8:
8^2 + h^2 = 10^2
h^2 = 36
h = 6
Now we can plug in the values we have:
(dx/dt)/8  (80/6)/(8^2)(2) = (dh/dt)/10
(dx/dt)/8  10/192 = (dh/dt)/10
We want to find (dh/dt), so we can isolate it on one side:
(dh/dt)/10 = (dx/dt)/8  10/192
(dh/dt) = (dx/dt)/0.8  1.25
We know that dx/dt = 2 when the base of the ladder is being pulled away from the wall at a rate of 2 feet per second. So when d = 8 and h = 6, we have:
(dh/dt) = (2)/0.8  1.25
(dh/dt) = 0.25
Therefore, when the base of the ladder is 8 feet from the wall, the top of the ladder is sliding down the wall
A person is walking away from a lamppost at a rate of 4 feet per second. The height of the lamppost is 20 feet. How fast is the person’s shadow lengthening when they are 25 feet from the lamppost?
Let’s draw a diagram to represent the situation:
lua
Copy code
\
 \
 \
 \
 \
 \
 \
 \
 \
 \
h \
 \

d
Here, the lamppost is represented by the vertical line on the left, and the person is walking away from it to the right. The distance between the person and the lamppost is represented by “d”, and the height of the lamppost is represented by “h”. We want to find how fast the person’s shadow is lengthening, which is represented by the length of the line segment from the person’s feet to the base of the lamppost, as the person walks away.
We can see that the height of the person’s shadow, which we’ll call “s”, is proportional to the height of the lamppost and inversely proportional to the distance between the person and the lamppost:
s/d = h/20
Taking the derivative of both sides with respect to time t, we get:
(ds/dt)/d  s/(d^2)(dd/dt) = (dh/dt)/20
We want to find (ds/dt) when d = 25 feet. We are given that the person is walking away from the lamppost at a rate of 4 feet per second, so dd/dt = 4. We are also given that the height of the lamppost is 20 feet, so dh/dt = 0.
When d = 25, we can use the proportion above to find s:
s/25 = 20/20
s = 25
So when the person is 25 feet from the lamppost, their shadow is 25 feet long.
Now we can plug in the values we have into the related rates equation:
(ds/dt)/d  s/(d^2)(dd/dt) = (dh/dt)/20
(ds/dt)/25  25/(25^2)(4) = 0
(ds/dt)/25 = 0.005
ds/dt = 0.005 * 25
ds/dt = 0.125
Therefore, when the person is 25 feet from the lamppost, their shadow is lengthening at a rate of 0.125 feet per second.
A ladder 10 feet long rests against a vertical wall. If the bottom of the ladder slides away from the wall at a rate of 2 feet per second, how fast is the top of the ladder sliding down the wall when the bottom of the ladder is 6 feet from the wall?
We can use the Pythagorean theorem to relate the distance of the ladder from the wall to the height it reaches on the wall. Let’s call the distance the bottom of the ladder is from the wall “x” and the height the ladder reaches on the wall “y”. Then we have:
x^2 + y^2 = 10^2
We can take the derivative of both sides of this equation with respect to time t to get the related rates:
2x(dx/dt) + 2y(dy/dt) = 0
We are given that the bottom of the ladder is sliding away from the wall at a rate of 2 feet per second, so dx/dt = 2. We want to find how fast the top of the ladder is sliding down the wall, so we need to solve for dy/dt.
When the bottom of the ladder is 6 feet from the wall, we can use the Pythagorean theorem to find the corresponding height on the wall:
6^2 + y^2 = 10^2
y^2 = 64
y = 8
So when the bottom of the ladder is 6 feet from the wall, the ladder is reaching a height of 8 feet on the wall.
Now we can plug in the values we have into the related rates equation:
2x(dx/dt) + 2y(dy/dt) = 0
2(6)(2) + 2(8)(dy/dt) = 0
12 + 16(dy/dt) = 0
16(dy/dt) = 12
dy/dt = 0.75
Therefore, when the bottom of the ladder is 6 feet from the wall, the top of the ladder is sliding down the wall at a rate of 0.75 feet per second.
The first two solutions are complete nonsense. But the third one is correct! That’s not nearly reliable enough to be useful, but it is the first time I’ve seen a completely correct solution in these experiments, so it’s worth noting.
Calculus 2: Oh yeah, I actually have to write a test
At some point I remembered that I actually had to write a test to give to my calc 2 class. So maybe I should see if I can write some questions for that.
Trig sub integrals
write some trig sub integral problems

Evaluate $\displaystyle\int \frac{\sqrt{9x^2}}{x^2} , dx$ using the substitution $x=3\sin\theta$.

Evaluate $\displaystyle\int \frac{1}{x^2\sqrt{x^2+4}} , dx$ using the substitution $x=2\tan\theta$.

Evaluate $\displaystyle\int \frac{1}{x\sqrt{x^21}} , dx$ using the substitution $x=\sec\theta$.

Evaluate $\displaystyle\int \frac{x^3}{\sqrt{1x^2}} , dx$ using the substitution $x=\sin\theta$.

Evaluate $\displaystyle\int \frac{dx}{\sqrt{x^2+9}\left(x^2+4\right)}$ using the substitution $x=3\tan\theta$.

Evaluate $\displaystyle\int \frac{x^3}{\sqrt{x^2+1}} , dx$ using the substitution $x=\tan\theta$.

Evaluate $\displaystyle\int \frac{1}{x^4\sqrt{4x^21}} , dx$ using the substitution $x=\frac{1}{2}\sec\theta$.

Evaluate $\displaystyle\int \frac{dx}{\sqrt{25x^2}\left(x^2+16\right)}$ using the substitution $x=5\sin\theta$.

Evaluate $\displaystyle\int \frac{x^3}{\sqrt{4x^21}} , dx$ using the substitution $x=\frac{1}{2}\sec\theta$.

Evaluate $\displaystyle\int \frac{\sqrt{16x^2}}{x^2} , dx$ using the substitution $x=4\sin\theta$.
Can you write solutions to those problems for me?

Let $x=3\sin\theta$. Then $dx=3\cos\theta, d\theta$, and $\sqrt{9x^2}=\sqrt{99\sin^2\theta}=3\cos\theta$. Substituting these into the integral, we get \[ \begin{array}{rl} \int \frac{\sqrt{9x^2}}{x^2} \, dx &= \int \frac{3\cos\theta}{9\sin^2\theta} \cdot 3\cos\theta\, d\theta \\\
&= \frac{1}{3} \int \csc^2\theta \, d\theta \\\
&= \frac{1}{3}\cot\theta + C \\\
&= \frac{1}{3}\cot(\sin^{1}(x/3)) + C. \end{array} \] 
Let $x=2\tan\theta$. Then $dx=2\sec^2\theta\, d\theta$, and $\sqrt{x^2+4}=\sqrt{4\tan^2\theta+4}=2\sec\theta$. Substituting these into the integral, we get \[ \begin{array}{rl} \int \frac{1}{x^2\sqrt{x^2+4}} \, dx &= \int \frac{1}{4\tan^2\theta \cdot 2\sec\theta} \cdot 2\sec^2\theta\, d\theta \\\
&= \frac{1}{2} \int \cos\theta \cdot \sec^3\theta \, d\theta \\\
&= \frac{1}{2} \int \frac{\cos\theta}{\cos^4\theta} \, d\theta \\\
&= \frac{1}{2} \int \frac{\cos\theta}{(1\sin^2\theta)^2} \, d\theta \\\
&= \frac{1}{2} \frac{\cos\theta}{1\sin^2\theta} + \frac{1}{2} \int \frac{1}{1\sin^2\theta} \, d\theta \\\
&= \frac{1}{2}\frac{\cos\theta}{1\sin^2\theta} + \frac{1}{4}\ln\left\frac{1+\sin\theta}{1\sin\theta}\right + C \\\
&= \frac{1}{2}\frac{x}{\sqrt{x^2+4}} + \frac{1}{4}\ln\left\frac{x+\sqrt{x^2+4}}{2}\right + C. \end{array} \]
Let $x=\sec\theta$. Then $dx=\sec\theta\tan\theta\, d\theta$, and $\sqrt{x^21}=\sqrt{\sec^2\theta1}=\tan\theta$. Substituting these into the integral, we get
\[
\begin{array}{rl}
\int \frac{1}{x\sqrt{x^21}} \, dx &= \int \frac{\sec\theta\tan\theta}{\tan\theta} \, d\theta \\\
&= \int \sec\theta \, d\theta \\\
&= \ln\sec\theta + \tan\theta + C \\\
&= \lnx+\sqrt{x^21} + C.
\end{array}
\]
First off, this obviously only answers three questions. I think it was hitting a character limit in the answer. It actually cut itself off right before finishing the third one: it stopped with the “\end” at the end of the array environment. But I decided to give it credit for that and finished off the environment syntax for it.
This was also the first time I had to do any other meaningful LaTeX editing. There are places where it should have produced a “\” or a “\,” and instead just gave a “" or “,”; I assume that’s some issue with the way it processes text. I went ahead and fixed that but wanted to make a note of it. (I also had to do some extra editing to make it render correctly on this site, but that says more about Markdown and MathJax than about ChatGPt.)
The substance of the answers is also interesting. Each of them does the substitution right, then screws up the algebra in the middle and gives a completely wrong answer at the end.
But the problems are pretty good!
Integration by parts
Let’s try some other integral approaches I need.
Prompt: Write an integration by parts problem and solve it.
Response 1
Sure, here’s an example:
Find $\displaystyle\int x^2\ln x \, dx$.
To solve this integral, we will use integration by parts with $u=\ln x$ and $dv=x^2\,dx$. Then $du=\frac{1}{x}\,dx$ and $v=\frac{1}{3}x^3$, so we have
\[
\begin{array}{rl}
\int x^2\ln x \, dx &= \frac{1}{3}x^3\ln x  \int \frac{1}{3}x^2 \, dx \\\
&= \frac{1}{3}x^3\ln x  \frac{1}{9}x^3 + C,
\end{array}
\]
where $C$ is the constant of integration. Therefore, we have
Response 2
Sure! Here’s a problem and its solution using integration by parts:
Problem: Evaluate $\int x^2\cos x\, dx$.
Solution: To solve this integral, we use integration by parts with $u=x^2$ and $dv=\cos x\, dx$. Then $du=2x\, dx$ and $v=\sin x$, so we have
\[
\begin{array}{rl}
\int x^2\cos x\, dx &= x^2\sin x  \int 2x\sin x\, dx \\\
&= x^2\sin x + 2\int x\sin x\, dx \\\
&= x^2\sin x + 2\left(x\cos x  \int \cos x\, dx\right) \\\
&= x^2\sin x + 2x\cos x  2\sin x + C \\\
&= \boxed{x^2\sin x + 2x\cos x  2\sin x + C}.
\end{array}
\]
And it can basically do this! The problems are standard. The first solution looks completely right; the second makes two sign errors, which cancel each other out. (It even boxed the answer in the second example for me, which I find fascinating.)
I wanted to see if I could get something a little more challenging.
Write a hard integration by parts problem and solve it.
Sure, here is a hard integration by parts problem:
Problem: Evaluate $\int x^2 e^{x} \cos x, dx$.
Solution: To solve this integral, we use integration by parts twice. First, we choose $u=x^2$ and $dv=e^{x} \cos x\, dx$, so $du=2x\, dx$ and $v=e^{x} \sin x$. Then we have
\[
\begin{array}{rl}
\int x^2 e^{x} \cos x\, dx &= x^2 e^{x} \sin x  \int 2xe^{x}\sin x\, dx \\\
&= x^2 e^{x} \sin x  2\left(xe^{x}\cos x  \int e^{x}\cos x\, dx\right) \\\
&= x^2 e^{x} \sin x + 2xe^{x}\cos x  2\left(e^{x}\sin x  \int e^{x}\sin x\, dx\right) \\\
&= x^2 e^{x} \sin x + 2xe^{x}\cos x + 2e^{x}\sin x  2\left(e^{x}\cos x  \int e^{x}\cos x\, dx\right) \\\
&= x^2 e^{x} \sin x + 2xe^{x}\cos x + 2e^{x}\sin x + 2e^{x}\cos x  2\int e^{x}\cos x\, dx \\\
&= x^2 e^{x} \sin x + 2xe^{x}\cos x + 2e^{x}\sin x + 2e^{x}\cos x  2\left(e^{x}\sin x + \int e^{x}\sin x\, dx\right) \\\
&= x^2 e^{x} \sin x + 2xe^{x}\cos x + 2e^{x}\sin x + 2e^{x}\cos x  2\left(e^{x}\cos x + \int e^{x}\cos x\, dx\right) \\\
&= x^2 e^{x} \sin x + 2xe^{x}\cos x + 2e^{x}\sin x + 2e^{x}\cos x + 2e^{x}\cos x + C \\\
&= \boxed{x^2 e^{x} \sin x + 4xe^{x}\cos x + 4e^{x}\sin x + C}.
\end{array}
\]
That’s an interesting problem, although too hard for my test. This time it doesn’t get the answer right, sadly. (It screws up on the first step!)
I want to see if I can get it to generate problems that have coefficients on the variables.
Write an integration by parts problem that has coefficients on the x.
Here’s an integration by parts problem that has coefficients on the x:
Problem: Evaluate $\int x^2\ln x\, dx$.
Solution: We can use integration by parts with $u = \ln x$ and $dv = x^2\, dx$, so $du = \frac{1}{x}\, dx$ and $v = \frac{x^3}{3}$. Then we have
\[
\begin{array}{rl}
\int x^2\ln x\, dx &= \frac{x^3\ln x}{3}  \int \frac{x^3}{3} \cdot \frac{1}{x}\, dx \\\
&= \frac{x^3\ln x}{3}  \frac{1}{3} \int x^2\, dx \\\
&= \frac{x^3\ln x}{3}  \frac{x^3}{9} + C \\\
&= \boxed{\frac{x^3}{9}(3\ln x  1) + C}.
\end{array}
\]
Wait a minute—it wrote that problem for me already! It’s still a solid problem, and it still got the solution right, but it’s not what I wanted.
Write an integration by parts problem where the integrand has scalar coefficients on the x terms
Here’s an integration by parts problem where the integrand has scalar coefficients on the x terms:
Problem: Evaluate $\int x e^{x} \sin x\, dx$.
Solution: We can use integration by parts with $u = \sin x$ and $dv = x e^{x}\, dx$, so $du = \cos x\, dx$ and $v = xe^{x}  e^{x}$. Then we have
\[
\begin{array}{rl}
\int x e^{x} \sin x\, dx &= x e^{x} \sin x + \int (\cos x  e^{x})\, dx \\\
&= x e^{x} \sin x + \sin x + e^{x} + C \\\
&= \boxed{(1x)e^{x}\sin x + e^{x}\cos x + C}.
\end{array}
\]
Still doesn’t have the coefficients I want, and it does the same thing it did for the “hard” problem I asked for: it asks a really challenging problem, then completely fails to compute it properly.
If I ask it to generate a bunch, will it give me what I want?
Write me ten integration by parts problems.
Sure, here are ten integration by parts problems:
 $\int x e^x \cos x\, dx$
 $\int x^2 \ln x\, dx$
 $\int x^3 e^x \, dx$
 $\int x^2 \cos x\, dx$
 $\int x \ln x\, dx$
 $\int x \cos x\, dx$
 $\int e^x \sin x\, dx$
 $\int \ln x\, dx$
 $\int x^3 \sin x\, dx$
 $\int x^2 e^{x} \, dx$
Note: Some of these integrals might be challenging to solve, so you may want to use different techniques (such as substitution) in addition to integration by parts.
This is a basically reasonable collection of problems, but literally zero of them have scalars.
I wonder if it’s stuck? I’ll start a clean chat rather than continuing the previous conversation:
Write me ten interesting integration by parts problems.
 Evaluate $\int xe^x \, dx$.
 Evaluate $\int x^2 \cos x \, dx$.
 Evaluate $\int \ln x \, dx$.
 Evaluate $\int \arctan x \, dx$.
 Evaluate $\int x \sin^2 x \, dx$.
 Evaluate $\int \cos^{1} x \, dx$.
 Evaluate $\int \frac{x}{(1+x^2)^2} \, dx$.
 Evaluate $\int x \ln x \, dx$.
 Evaluate $\int \sqrt{x} e^x \, dx$.
 Evaluate $\int x \sin x \, dx$.
Basically the same, although 7 isn’t an integration by parts problem, and I don’t think 9 is really doable in a standard calculus course.
But I know what I want; if I write the problem can it solve it for me?
Evaluate $\int x \sin^2 (3x) \,dx$
We can use integration by parts with $u=x$ and $dv=\sin^2(3x) \, dx$. Then $du=dx$ and we can use the double angle formula $\sin^2(3x) = \frac{1}{2}(1  \cos(6x))$ to get
\[
\begin{array}{rl}
\int x \sin^2(3x) \, dx &= \frac{1}{2} \int x(1\cos(6x)) \, dx \\\
&= \frac{1}{2}\left(\int x \, dx  \int x \cos(6x) \, dx\right) \\\
&= \frac{1}{2}\left(\frac{1}{2}x^2  \frac{1}{6}x\sin(6x)  \frac{1}{36}\cos(6x) \right) + C,
\end{array}
\]
where $C$ is the constant of integration. Therefore,
Evaluate $\int x \ln (5x)\, dx$
We can use integration by parts with $u = \ln(5x)$ and $dv = x \, dx$. Then, $du = \frac{1}{x} \, dx$ and $v = \frac{1}{2}x^2$. Therefore, we have
\[
\begin{array}{rl}
\int x \ln(5x) \, dx &= \frac{1}{2}x^2\ln(5x)  \int \frac{1}{2}x^2 \cdot \frac{1}{x} \, dx \\\
&= \frac{1}{2}x^2\ln(5x)  \frac{1}{4}x^2 + C,
\end{array}
\]
where $C$ is the constant of integration. Therefore,
Evaluate $\int xe^{4x} \, dx$.
We can use integration by parts with $u=x$ and $dv=e^{4x} \, dx$. Then, $du=dx$ and $v=\frac{1}{4}e^{4x}$. Therefore, we have
\[
\begin{array}{rl}
\int xe^{4x} \, dx &= \frac{1}{4}xe^{4x} + \frac{1}{4}\int e^{4x} \, dx \\\
&= \frac{1}{4}xe^{4x}  \frac{1}{16}e^{4x} + C,
\end{array}
\]
where $C$ is the constant of integration. Therefore,
Does pretty well with that!
But let’s do a test with my favorite kind of integration by parts problem.
Evaluate $\int sin(3x) e^{4x} \, dx$.
We can use integration by parts with $u = \sin(3x)$ and $dv = e^{4x} \, dx$. Then, $du = 3\cos(3x) \, dx$ and $v = \frac{1}{4}e^{4x}$. Therefore, we have
\[
\begin{array}{rl}
\int \sin(3x) e^{4x} \, dx &= \frac{1}{4}\sin(3x) e^{4x} + \frac{3}{4}\int \cos(3x) e^{4x} \, dx \\\
&= \frac{1}{4}\sin(3x) e^{4x} + \frac{3}{16}\cos(3x) e^{4x}  \frac{9}{16}\int \sin(3x) e^{4x} \, dx.
\end{array}
\]
Rearranging terms, we get
\[
\begin{array}{rl}
\int \sin(3x) e^{4x} \, dx &= \frac{3}{25}\left(\frac{1}{4}\sin(3x) e^{4x} + \frac{3}{16}\cos(3x) e^{4x}\right) + C \\\
&= \frac{3}{100}\sin(3x) e^{4x} + \frac{9}{400}\cos(3x) e^{4x} + C,
\end{array}
\]
where $C$ is the constant of integration. Therefore,
It got the right basic idea, but made a couple of minor mistakes. (It also didn’t show work for what’s probably the trickiest step, so it’s not a great template to follow.)
Evaluate $\int \cos(2x) e^{3x} \, dx$.
Using the identity $\cos(2x) = \cos(2x)$, we can write
\[
\begin{array}{rl}
\int \cos(2x) e^{3x} \, dx &= \int \cos(2x) e^{3x} \, dx \\\
&= \frac{1}{5}\cos(2x) e^{3x} + \frac{2}{5}\int \sin(2x) e^{3x} \, dx.
\end{array}
\]
We can then use integration by parts with $u = \sin(2x)$ and $dv = e^{3x} \, dx$. Then, $du = 2\cos(2x) \, dx$ and $v = \frac{1}{3}e^{3x}$. Therefore, we have
\[ \begin{array}{rl} \int \cos(2x) e^{3x} \, dx &= \frac{1}{5}\cos(2x) e^{3x} + \frac{4}{15}\sin(2x) e^{3x}  \frac{8}{15}\int \cos(2x) e^{3x} \, dx. \end{array} \]
Rearranging terms, we get
\[\begin{array}{rl} \int \cos(2x) e^{3x} \, dx &= \frac{1}{17}\cos(2x) e^{3x} + \frac{4}{51}\sin(2x) e^{3x} + C, \end{array} \]
where $C$ is the constant of integration. Therefore,
A very good catch that \(\cos(x)\) is an even function, but it doesn’t handle the actual integration very well. It doesn’t show work for the first integration by parts, and in fact gets it wrong. And then it keeps making more mistakes at every step.
So like with the related rates problems, this is pretty good at brainstorming questions, but not so great at solving them.
Partial Fractions
Let’s try some partial fractions integrals.
Write me an integral that involves partial fractions, and solve it
Sure! Here’s an example:
Evaluate the integral
To solve this integral, we first need to factor the denominator:
Since $x^2+1$ is an irreducible quadratic over the real numbers, we cannot factor it any further. However, we can use partial fractions to write the integrand as a sum of simpler fractions:
where $A$, $B$, $C$, and $D$ are constants to be determined. To find these constants, we can multiply both sides by the denominator and then equate coefficients of like terms:
\[
\begin{array}{rl}
4x^3  7x^2 + 2x  1 &= A(x2)(x^2+1) + B(x1)(x^2+1) + (Cx+D)(x1)(x2) \\\
&= (A+B+C)x^3 + (2A2B+C+D)x^2 + (A+BC)x + (2A+2B+D).
\end{array}
\]
Equating coefficients of like terms, we get the system of equations
\[
\begin{array}{rl}
A + B + C &= 4 \\\
2A  2B + C + D &= 7 \\\
A + B  C &= 2 \\\
2A + 2B + D &= 1.
\end{array}
\]
Solving this system of equations, we find $A = 1$, $B = 2$, $C = 2$, and $D = 1$. Therefore, we have
\[
\begin{array}{rl}
\int \frac{4x^3  7x^2 + 2x  1}{x^4  5x^3 + 4x^2 + 4x  4} , dx &= \int \frac{1}{x1} \, dx + \int \frac{2}{x2} \, dx + \int \frac{2x+1}{x^2+1} \, dx \\\
&= \lnx1 + 2\lnx2  \ln(x^2+1) + C,
\end{array}
\]
where $C$ is the constant of integration.
That is, indeed, a partial fractions problem. A very, very difficult partial fractions problem. Which it proceeds to get badly wrong, starting by factoring the denominator incorrectly (though it does find a real factor, which I’m impressed by if it wasn’t an accident).
It does integrate the function it finds correctly, though!
Let’s look at another one.
Response 2
Sure, here’s an integral that involves partial fractions:
To solve this integral, we first factor the denominator as $(x+1)(x+3)$. Then, we write the fraction as
where $A$ and $B$ are constants to be determined. Multiplying both sides by $(x+1)(x+3)$ and equating coefficients, we get
Expanding and collecting like terms, we get
Equating coefficients, we have
\[
\begin{array}{rl}
A + B &= 3 \\\
3A &= 1 \\\
B &= 2
\end{array}
\]
Solving for $A$ and $B$, we get $A = \frac{1}{3}$ and $B = 2$. Therefore,
\[
\begin{array}{rl}
\int \frac{3x+1}{x^2+4x+3} \, dx &= \int \frac{1}{x+1} \, dx  2\int \frac{1}{x+3} \, dx \\\
&= \lnx+1  2\lnx+3 + C,
\end{array}
\]
where $C$ is the constant of integration. Therefore,
This time we get a reasonable problem. I could put this on a test! But we don’t get a correct solution. ChatGPT factors the denominator correctly, and sets up equations to solve correctly, but then solves them incorrectly. It doesn’t give either the correct integral, or the one it found, but then integrates the formula it found correctly.
Let’s give it one more try.
Response 3
Here’s an integral that involves partial fractions:
To solve this integral, we first need to factor the denominator. We can write
Therefore, we can rewrite the integral as
\[\begin{array}{rl} \int \frac{x^3}{x^24x+3} \, dx &= \int \frac{x^3}{(x1)(x3)} \, dx \ &= \int \frac{Ax+B}{x1} \, dx + \int \frac{Cx+D}{x3} \, dx, \end{array}\]
where $A$, $B$, $C$, and $D$ are constants to be determined. Multiplying both sides by the denominator, we get
Expanding and equating coefficients, we get
\[\begin{array}{rl}
A+C &= 0 \\\
3A+B+D &= 0 \\\
3B+D &= 0 \\\
B &= 1
\end{array}\]
Solving for $A$, $B$, $C$, and $D$, we get
Therefore, we can write
\[\begin{array}{rl}
\int \frac{x^3}{x^24x+3} \, dx &= \int \frac{\frac{1}{2}x1}{x1} \, dx + \int \frac{\frac{1}{2}x+\frac{3}{2}}{x3} \, dx \\\
&= \frac{1}{2}\lnx1  \frac{1}{2}\lnx3  \frac{5}{4}\int \frac{1}{x1} \, dx + \frac{3}{4}\int \frac{1}{x3} \, dx \\\
&= \frac{1}{2}\ln\left\frac{x1}{x3}\right  \frac{5}{4}\lnx1 + \frac{3}{4}\lnx3 + C \\\
&= \frac{1}{4}\ln\left\frac{x1}{x3}\right  \frac{5}{4}\lnx1 + \frac{3}{4}\lnx3 + C,
\end{array}\]
where $C$ is the constant of integration. Therefore,
A reasonable problem, again! I start with polynomial long division instead of a janky polynomial long division that isn’t quite set up right; at any rate it solves the equations it sets up incorrectly, does the integrals wrong, and winds up with the wrong answer.
Other miscellaneous experiments
Write a numeric integration problem
Here’s a numeric integration problem:
Approximate the value of the integral
using the trapezoidal rule with $n=4$ subintervals.
Solution:
Using the trapezoidal rule, we have
\[\begin{array}{rl}
\int_0^1 \frac{x}{1+x^2} , dx &\approx \frac{1}{2}\left[f(0)+f\left(\frac{1}{4}\right)\right]+\frac{1}{2}\left[f\left(\frac{1}{4}\right)+f\left(\frac{1}{2}\right)\right]\\\
&\qquad+\frac{1}{2}\left[f\left(\frac{1}{2}\right)+f\left(\frac{3}{4}\right)\right]+\frac{1}{2}\left[f\left(\frac{3}{4}\right)+f(1)\right]\\\
&= \frac{1}{2}\left[\frac{0}{1+0^2}+\frac{\frac{1}{4}}{1+\left(\frac{1}{4}\right)^2}\right]+\frac{1}{2}\left[\frac{\frac{1}{4}}{1+\left(\frac{1}{4}\right)^2}+\frac{\frac{1}{2}}{1+\left(\frac{1}{2}\right)^2}\right]\\\
& \qquad +\frac{1}{2}\left[\frac{\frac{1}{2}}{1+\left(\frac{1}{2}\right)^2}+\frac{\frac{3}{4}}{1+\left(\frac{3}{4}\right)^2}\right]+\frac{1}{2}\left[\frac{\frac{3}{4}}{1+\left(\frac{3}{4}\right)^2}+\frac{1}{1+1^2}\right]\\\
&\approx 0.3735
\end{array}\]
Therefore, the approximate value of the integral using the trapezoidal rule with $n=4$ subintervals is $0.3735$.
A reasonable problem, almost sets up the calculation correctly but forgets to include the \(\Delta x\) term, and then does the numeric calculation at the end wrong.
Can you estimate the error in the previous calculation?
Yes, we can estimate the error in the previous calculation using the error bound formula for the trapezoidal rule:
where $K$ is an upper bound on the second derivative of the function over the interval of integration.
For our integral $\int_0^1 \frac{x}{1+x^2} , dx$, we have
\[\begin{array}{rl}
f(x) &= \frac{x}{1+x^2} \\\
f’‘(x) &= \frac{2x^32x}{(1+x^2)^3} \\\
\end{array}\]
Taking the absolute value and finding the maximum value of $f’‘(x)$ on the interval $[0,1]$, we have:
\[\begin{array}{rl}
f’‘(x) &= \frac{2x(1x^2)}{(1+x^2)^3} \\\
f’‘(x) &\leq \frac{2(10)}{(1+0^2)^3} = 2 \\\
\end{array}\]
Therefore, $K=2$, and we can estimate the error as:
\[\begin{array}{rl}
E_T &\leq \frac{K(ba)^3}{12n^2} \\\
&= \frac{2(10)^3}{12(4)^2} \\\
&= \frac{1}{96} \\\
&\approx 0.0104 \\\
\end{array}\]
So the error in our previous calculation is estimated to be less than $0.0104$.
It figures out what I’m asking, and gives the right formula and right basic procedure. But it computes the second derivative wrong, and I have no idea where it’s getting the upper bound on the derivative from.
Write and solve a problem that involves the inverse function theorem
Here’s a problem that involves the inverse function theorem:
Suppose $f(x) = x^3  4x + 2$ and $g(x) = \sqrt[3]{x+4}$ for $x \geq 4$. Let $h(x) = f(g(x))$. Find $h’(x)$.
Solution:
Using the chain rule, we have:
\[\begin{array}{rl}
h(x) &= f(g(x)) \\\
h’(x) &= f’(g(x)) \cdot g’(x) \\\
&= (3g(x)^2  4) \cdot \frac{1}{3\sqrt[3]{(x+4)^2}} \\\
&= \frac{3\sqrt[3]{(x+4)^2}(3\sqrt[3]{(x+4)})^2  4}{3\sqrt[3]{(x+4)^2}} \\\
&= \frac{9(x+4)  4}{3\sqrt[3]{(x+4)^2}} \\\
&= \frac{9x + 32}{3\sqrt[3]{(x+4)^2}} \\\
&= \frac{3(3x+32)}{\sqrt[3]{(x+4)^2}} \\\
\end{array}\]
Therefore, $h’(x) = \frac{3(3x+32)}{\sqrt[3]{(x+4)^2}}$.
That’s not the inverse function theorem. It’s almost a correct solution, though! Let’s give it another chance.
Response 2
Here’s a problem that involves the inverse function theorem:
Let $f(x) = \sqrt{x^2 + 1}$ for $x \in \mathbb{R}$. Show that $f$ is invertible on $[0,\infty)$, find its inverse function $f^{1}$, and calculate $(f^{1})’(1)$.
Solution:
To show that $f$ is invertible on $[0,\infty)$, we need to show that $f$ is onetoone and onto on this interval.
First, note that $f(x) > 0$ for all $x \in \mathbb{R}$, so $f$ is onto on $[0,\infty)$.
To show that $f$ is onetoone on $[0,\infty)$, suppose $f(x_1) = f(x_2)$ for some $x_1,x_2 \in [0,\infty)$. Then $\sqrt{x_1^2 + 1} = \sqrt{x_2^2 + 1}$, so $x_1^2 + 1 = x_2^2 + 1$, which implies $x_1 = x_2$. Therefore, $f$ is onetoone on $[0,\infty)$, and hence it is invertible on this interval.
To find the inverse function of $f$, we solve for $x$ in terms of $y$ in the equation $y = \sqrt{x^2 + 1}$:
\[\begin{array}{rl}
y &= \sqrt{x^2 + 1} \\\
y^2 &= x^2 + 1 \\\
x^2 &= y^2  1 \\\
x &= \pm\sqrt{y^2  1}
\end{array}\]
Since $f(x) > 0$ for all $x \in \mathbb{R}$, we take the positive square root to define the inverse function $f^{1}$:
To calculate $(f^{1})’(1)$, we use the inverse function theorem, which states that if $f$ is differentiable and invertible with inverse function $f^{1}$, then $(f^{1})’(y) = \frac{1}{f’(f^{1}(y))}$.
In this case, we have $f(x) = \sqrt{x^2 + 1}$, so $f’(x) = \frac{x}{\sqrt{x^2 + 1}}$. Therefore, $f^{1}(y) = \sqrt{y^2  1}$ and $f’(f^{1}(y)) = \frac{f^{1}(y)}{\sqrt{(f^{1}(y))^2 + 1}} = \frac{\sqrt{y^2  1}}{\sqrt{(y^2  1) + 1}} = \frac{\sqrt{y^2  1}}{y}$.
Substituting $y=1$, we get $(f^{1})’(1) = \frac{\sqrt{(1)^2  1}}{1} = \sqrt{0} = 0$. Therefore, $(f^{1})’(1) = 0$.
This isn’t really what I was looking for, but it is much more responsive, at least. (The solution still has a bunch of minor errors.)
Prompt: Write an integral that involves logarithms or exponentials
I asked it to respond to this prompt five different times, and five tiems it came up with \( \int \ln(x) \,dx\). It was very convinced that was the right response. I got better results with the following prompt:
Write some integral problems that involve logarithms
 $\displaystyle\int \frac{\ln(x)}{x} dx$
 $\displaystyle\int \ln(\sqrt{x^2 + 1}) dx$
 $\displaystyle\int \frac{\ln(2x + 1)}{x + 1} dx$
 $\displaystyle\int \ln^2(x) dx$
 $\displaystyle\int \frac{1}{x\ln(x)} dx$
 $\displaystyle\int \ln(x)e^{\ln(x)} dx$
 $\displaystyle\int \ln(x) \sqrt{x} dx$
 $\displaystyle\int \ln^3(x) dx$
 $\displaystyle\int \frac{\ln(x)}{(x+1)^2} dx$
 $\displaystyle\int \frac{1}{x\ln^2(x)} dx$
Then I picked one of these and asked ChatGPT to work out a solution; but it went off the rails immediately. And then I realized that I’d forgotten to type the integral sign in the question. I guess putting in a badlywritten question pushed it to give a badly written response. When I typed the question correctly, I got a clean and correct solution immediately! But for some reason, it rendered the LaTeX instead of displaying the code, so I couldn’t copy and paste it. That was new behavior and I don’t understand it.
This was really interesting, and occasionally useful. So I’m probably going to keep playing around with it. I may write a followup if I find anything especially interesting. But for now I’ll leave it here
Have you tried using chatbots to write assignments? Have you gotten them to do useful things for you? Do you have ideas for how I could make this work better? Tweet me @ProfJayDaigle or leave a comment below.

I know you’re seeing some weird formatting on the second derivative, but that’s not actually ChatGPT’s fault; that has to do with a bug in the way LaTeX compiles through MathJax, which is what allows me to display it on the blog. I could fix the display issue but I wanted to keep the output genuinely unedited. ↩

Note: at this point I also started a new conversation, to see if that would change things. I haven’t done a lot of testing on how much stuff changes if you continue a previous conversational thread versus starting a new one. ↩
Tags: math machine learning artificial intelligence gpt teaching