What AI Can Do: Writing Useful Math Word Problems

TL;DR – Being specific is a necessary but not sufficient condition for prompts for AI. Including examples in your prompts can work wonders. Now, read on.

Let me tell you about one of the worst math games I ever saw. It was used in an alternative high school program for students who were behind in math. A math problem appeared on a screen, with an outer space background. The student typed in an answer. If it was correct, an alien appeared and hit a golf ball. That was it. That was the whole game, over and over. I watched it for a while and it just slipped out, I exclaimed,

“That looks boring as @#$ !”

Without turning around, the student responded, “It is.”

Since we pride ourselves on making games that teach math in context, I spend part of my time writing math problems. We know that games that include a story and game play, like search games, platformer games, etc. have more game play, more math problems solved by students. So, I spend time coming up with math problems that both fit a story and address a standard.

As anyone who uses AI can tell you, one key to getting the response from Gemini or ChatGPT is be specific.

My first, unsuccessful prompt.

“Write ten math problems requiring using an equation, in the context of ranching.”

– Produced several problems that were not what I needed. Something like

Problem: A rancher needs to distribute 500 liters of water equally among 5 cattle troughs. How many liters of water will each trough receive?
Equation:   Total water /Number of troughs=Water per trough

That is a problem and it does have an equation but I’m really looking for something at the middle school level that addresses this math standard, “Solve real-life and mathematical problems using numerical and algebraic expressions and equations.” Instead, I got a division problem.

My final, (mostly) successful prompt.

In my final prompt (I’ll skip the iterations in between), I started with the same prompt and added the instruction to give both the equation and the answer. What really made a difference in the results, though, was including specific examples. I found two examples to be sufficient to increase the percentage of useful responses I received from 10-30% each time to 100%. In the example below, I used blank lines and indented the examples for readability, but you could just type it all as one paragraph.

Write ten math problems requiring using an equation, in the context of ranching. Do not repeat the same problem. Give the equation used to solve the problem and the answer.

Example:  You need to fence in a 400-foot perimeter. You’ll put a post every 8 feet. A six-pack of posts costs $30. A foot of wire costs $.24. What is the equation to compute the cost of the fence?

Equation:   (.24 x 400) +  30 * ((400/8)/6)
Answer:    346 

Example: You have 500 head of cattle. Each cow needs to eat 20 pounds of hay per day. You have 10,000 pounds of hay in storage. How many days will the hay last?

Equation:  10,000/ (500 x 20)
Answer:   1

Here are two examples of the responses I received.

**Problem:** You have 500 head of cattle. You want to sell each cow for $1,000. You also have 200 acres of land that you can sell for $10,000 per acre. How much money will you make if you sell all of your cattle and land?

**Equation:** (500 * 1000) + (200 * 10000)

**Answer:** $2,100,000

**Problem:** You have 100 head of cattle. You want to vaccinate each cow for $10. You also need to buy dewormer for each cow for $5. How much will it cost to vaccinate and deworm all of your cattle?

**Equation:** (100 * 10) + (100 * 5)

**Answer:** $1,500

Using examples, all of the questions I received were exactly in the format that I wanted. I can now use these in a word problem block in a game where the problem is inserted into the text field asking the question, the equation is inserted in the text field in the dialog box that pops up when the player clicks on a hint button and the answer is inserted in the data field.

Pretty cool, huh?

One last tip – notice that I included “Do not repeat the same problem.”  While you might think that is obvious, without that, I would get the same problem two or three times. Since my program is randomly pulling problems from the array, having a problem repeated would mean a student might get presented with the exact same problem more than once. Adding the instruction not to repeat, I did get similar problems, essentially, the same problem with different numbers, but that’s actually fine because teachers usually do want to assess the same concept more than once.

Leave a comment

Your email address will not be published. Required fields are marked *