← Library

The Number Kingdom

The Perimeter Problem

The Perimeter Problem

The Wall That Wobbled

Mira arrived at the kingdom's eastern border to find the Count standing stiffly before a wall that was doing something very strange. The wall was rippling.

Not crumbling. Not cracking. Rippling, like a ribbon caught in a breeze. The stone blocks stretched and squished, bulging outward in some places and squeezing thin in others, all while keeping the same height.

"Right. Let's see what's broken," Mira said, swinging her satchel around.

"The crisis is as follows," the Count announced, his voice tight with formality. "The kingdom's boundary walls maintain the magical properties of our borders. The perimeter of these walls must remain constant—exactly six hundred paces around. If the perimeter changes, the border magic fails, and the kingdom becomes... porous."

"Porous how?" Mira asked.

A small stone near the base of the wall suddenly popped loose and floated away like a dandelion seed. Then another. And another.

"Ah. That porous," Mira said.

From somewhere behind the wall came a delighted giggle. A wisp of shimmering air swirled into view, gathering itself into the familiar shape of the Remainder—half-formed, slightly too large for the space it occupied, grinning with the particular joy of someone who had done something naughty and was very proud of it.

"I simply adjusted the shape!" the Remainder said, gesturing grandly at the wall. "I didn't change the wall's area at all. Not one bit. The wall still encloses the exact same amount of kingdom. I just made the shape a bit more... interesting."

Mira pulled out her paper and pencil. "Let me see this wall."

The wall ran in a long straight line toward the north, then turned at a right angle, then turned again. Mira walked along it, counting her paces and sketching as she went.

The original wall had been a perfect rectangle: 200 paces long and 100 paces wide. Mira did the calculation in her head—200 plus 100 plus 200 plus 100. Six hundred paces around. That was the perimeter.

But the Remainder had changed the shape. Now the wall didn't run straight. It jagged in and out, creating little rectangular alcoves and protrusions. Mira counted the segments carefully.

"Two hundred," she said, tracing the longest section. Then: "Thirty, thirty, forty, forty, fifty, fifty..." She wrote down all the side lengths as she walked.

When she finished, she added them all up.

Two hundred, plus thirty, plus thirty, plus forty, plus forty, plus fifty, plus fifty, plus thirty, plus thirty, plus forty, plus forty, plus fifty, plus fifty.

Mira scribbled in her notebook, adding carefully. Then she stopped.

"Seven hundred and forty," she said. "That's not six hundred."

"Correct!" the Remainder clapped its shimmering hands. "But here's the marvelous thing—I didn't change the area! The magical properties of the border require a specific perimeter, but I've kept the area exactly the same. Exactly! And yet the perimeter is different. Isn't that wonderful?"

Drawing and Thinking

Mira sat down on a nearby stone and looked at her drawing.

The original wall was a rectangle: 200 by 100. Area: 200 × 100 = 20,000 square paces. Perimeter: 200 + 100 + 200 + 100 = 600 paces.

The Remainder's new wall had the same area. Mira checked this by dividing the shape into rectangles in her notebook. She added up the areas of each section. Sure enough: 20,000 square paces. The area was identical.

But the perimeter was larger. Seven hundred forty paces instead of six hundred.

"That's the thing about perimeter," Mira said to herself, tapping her pencil against her chin. "Perimeter is the distance around the shape. The area is the space inside the shape. They're completely different measurements."

She drew two shapes in her notebook. One was a long, thin rectangle: 40 paces by 10 paces. Perimeter: 40 + 10 + 40 + 10 = 100 paces. Area: 40 × 10 = 400 square paces.

Then she drew a square: 20 paces by 20 paces. Perimeter: 20 + 20 + 20 + 20 = 80 paces. Area: 20 × 20 = 400 square paces.

"Same area," Mira said. "Different perimeter. The square has less distance around it, but the same amount of space inside."

She looked up at the rippling wall. "The Remainder is right. Same area, different perimeter. And that's a real thing that can happen."

"So you admit it!" the Remainder crowed. "My wall is fine!"

"It's mathematically possible," Mira said. "But it's still wrong. The border magic needs six hundred paces around, not seven hundred forty. The wall has to go back to the original shape."

"Ah, but you can't change the area!" the Remainder said, wagging a finger made of shimmering air. "The area must remain 20,000. If you make the wall any shorter around, you'll have to change the area. And that's forbidden by the rules of the magic!"

Mira frowned. The Remainder was right about that part. The wall's area had to stay the same.

"Wait," she said slowly. "If the area is 20,000 square paces, and the perimeter has to be 600 paces... what shapes can I make?"

Trying and Failing

Mira started drawing rectangles in her notebook.

"A rectangle with sides A and B has area A × B and perimeter 2 × (A + B)," she wrote.

"The original wall is 200 by 100. Area: 20,000. Perimeter: 600."

She tried a square. If the area was 20,000 square paces, the sides would be the square root of 20,000—about 141.4 paces. The perimeter would be about 565.7 paces. That wasn't 600.

She tried a rectangle that was 250 by 80. Area: 250 × 80 = 20,000. Perimeter: 250 + 80 + 250 + 80 = 660. Too much.

She tried 400 by 50. Area: 400 × 50 = 20,000. Perimeter: 400 + 50 + 400 + 50 = 900. Way too much.

She tried 160 by 125. Area: 160 × 125 = 20,000. Perimeter: 160 + 125 + 160 + 125 = 570. Too little.

Mira stared at her paper. "Hmm."

"Giving up?" the Remainder asked hopefully.

"No," Mira said. "I'm thinking."

She looked at her numbers. 250 by 80 gave perimeter 660. 160 by 125 gave perimeter 570. Somewhere between those, there had to be a rectangle with area 20,000 and perimeter exactly 600.

"If the perimeter is 600, then A + B must be 300," she wrote. "So B = 300 − A."

"And the area is A × B = 20,000."

"So A × (300 − A) = 20,000."

Mira worked through it carefully. A × 300 − A × A = 20,000. That meant A × A − 300 × A + 20,000 = 0.

She tried A = 100. Then A × A = 10,000, and 300 × A = 30,000. 10,000 − 30,000 + 20,000 = 0. That worked! So A = 100, and B = 300 − 100 = 200.

"The original rectangle!" Mira said. "200 by 100. That's the only rectangle with area 20,000 and perimeter 600."

"And the only rectangle," the Remainder said. "But who said the wall has to be a rectangle?"

Mira paused. The Remainder had a point—a genuinely interesting one. There were other shapes with area 20,000 and perimeter 600. Any shape at all, as long as the numbers worked.

"True," Mira said. "But the original wall was a rectangle. The border magic worked with the rectangle. So I need to put it back."

"How?" the Remainder asked. "You can't change the wall's area. You can only change its shape. And I've made the shape very interesting. Changing it back won't change the perimeter... unless you change the area too."

Mira looked at the jagged wall. The Remainder was clever. Every time Mira pushed a section of wall inward to make the shape more rectangular, she'd have to push another section outward to keep the area the same. But pushing outward would make the perimeter larger again...

Wait.

Mira stared at the wall. Then she started drawing again.

"What if I push the wall inward in one place and outward in another—but I do it in a way that cancels out the perimeter change?"

She drew a little rectangular bump sticking out of a straight wall. If the bump was 10 paces wide and stuck out 5 paces, it added three new sides to the perimeter: 5 + 10 + 5 = 20 paces. But the original wall segment it replaced was 10 paces. So the bump added 10 paces to the perimeter.

"But if I push the wall inward by the same amount somewhere else," Mira said, "I remove perimeter instead of adding it."

She drew a dent: 10 paces wide and 5 paces deep. The dent replaced a 10-pace wall segment with three segments: 5 + 10 + 5 = 20. Wait, no. A dent would also add to the perimeter, because the wall still had to go down into the dent and back up.

Mira frowned. "Actually, both bumps and dents add perimeter. Because the wall has to travel further to go around them."

The Zero Insight

Mira sat back, frustrated. The Remainder giggled.

"Every time you make the wall not-straight," the Remainder said, "you add distance. The shortest path between two points is a straight line. So the rectangle has the smallest perimeter for a given area... oh no. Wait."

The Remainder's grin flickered. It looked at the wall. It looked at Mira.

"The rectangle has the smallest perimeter of all the rectangles with that area," Mira said slowly. "But it's not the smallest perimeter of all shapes. A circle would be even smaller. But the wall has to be a rectangle because the border magic was set up for a rectangle. So the rectangle is the shape I need."

"Then you're stuck!" the Remainder said, recovering its glee. "You can't change the wall's shape back to a rectangle without changing the perimeter, and you can't change the area. The wall is stuck as my lovely jagged mess forever!"

Mira looked at her drawings. She looked at the wall. She looked at the numbers.

"Wait," she said. "What if I changed the shape and changed the perimeter at the same time? Push one section out to make a bump, and push another section out to make the wall shorter overall..."

She drew a new sketch. "If I push a section of wall outward to make a bump, the perimeter gets longer. But if I remove a section from somewhere else entirely—make the wall shorter—the perimeter gets shorter. If I do both at once, the perimeter could stay the same while the shape changes."

"What?" the Remainder said. "That doesn't make sense. You'd have to build a new wall somewhere."

"Exactly," Mira said. "I don't have to use the same wall. I just have to make a wall with the same area and the right perimeter. The original wall was 200 by 100. I can build a new wall in the same shape, with the same areas, and the perimeter will be right."

"But the area—" the Remainder started.

"Is the same." A quiet, silver voice spoke from behind them. Zero had appeared, perfectly round and utterly calm. "The wall has been stretched and squished, but it has not gained or lost material. You don't need to change the area. You need to change the shape back."

Zero floated over to the wall and touched a stone. "The wall's area is the space it encloses. The perimeter is the distance around it. They are different measurements. Changing one does not necessarily change the other—but restoring the original shape restores the original perimeter."

"Right," Mira said. "I don't need to make the perimeter different. I need to make the shape right. And when the shape is right, the perimeter will be right too."

She turned to the Count. "I need to rebuild the wall in the original shape. The same 200 by 100 rectangle. The same area. The same perimeter. The border magic needs the rectangle—so the rectangle is what we build."

The Count nodded slowly. "And the wall's area?"

"Stays exactly the same," Mira said. "20,000 square paces. I'm not changing the area. I'm changing the perimeter by changing the shape."

She picked up a piece of chalk from her satchel and began drawing the outline of the correct wall directly on the ground, a perfect rectangle: 200 paces by 100 paces.

As she drew, the stones of the wall began to shift and settle, following her lines. The jagged bumps smoothed. The dents filled. The wall lengthened and shortened itself, sliding into place like puzzle pieces finding their positions.

And when she finished, the wall stood straight and true: a perfect rectangle, 200 paces long and 100 paces wide.

Mira walked the perimeter, counting. "Two hundred. One hundred. Two hundred. One hundred. Six hundred paces."

The wall stopped rippling. The stones locked together. The magical glow of the border returned, bright and steady.

The Remainder's Question

"All right," the Remainder said, pouting. "It's fixed. But I still don't see what the problem was. The area was the same! I kept the area exactly, perfectly, wonderfully the same!"

"That's true," Mira said. "You did. But perimeter and area are different things. The area is how much space the wall encloses. The perimeter is how far you have to walk to go around it. The border magic needed a specific perimeter, not a specific area."

"Because the sentries have to walk the walls," the Count added. "The patrol route is exactly six hundred paces. Any longer, and the sentries cannot make their rounds in time. Any shorter, and the patrol cannot cover the full border."

"So the perimeter matters," Mira said. "And the shape matters, because the perimeter depends on the shape."

The Remainder tilted its shimmering head. "Then why didn't you just make a different rectangle with the same area and the same perimeter?"

"There is no other rectangle with area 20,000 and perimeter 600," Mira said. "I checked. The original is the only one. Long and thin gives too much perimeter. Short and fat gives too little. The rectangle that fits both is exactly the one that was there before."

"Mmm." The Remainder considered this. Then its grin returned. "But you know what's fascinating? If I'd made the wall a circle instead of a rectangle, the perimeter would have been much smaller for the same area. Only about 501 paces around! You could have saved 99 paces of wall entirely."

Mira paused. She did the calculation in her head. A circle with area 20,000 square paces would have a radius of about 79.8 paces, and a circumference of about 501.5 paces. Less than 600. Less than the rectangle.

"That's true," she said. "A circle is more efficient than a rectangle. It has less perimeter for the same area. But the border magic was set up for a rectangle—specifically, for 200 by 100. Changing the shape would have changed the perimeter, because different shapes have different perimeters."

She smiled. "That's what makes perimeter interesting. The same area can have many different perimeters. Every shape is different around the outside, even when it's the same on the inside."

The Remainder's grin widened. "So you admit there are shapes that would have been better?"

"I admit there are shapes that would have been different," Mira said. "Better depends on what you need. The kingdom needed a rectangle. So the rectangle is what we built."

The Remainder considered this. "Hmm. Fair enough." It began to dissolve into the air, a trailing wisp of mathematical mischief. "But I liked my jagged wall. Every sentry who walks the border now has a longer walk. I did the kingdom a favor! They're all getting more exercise!"

And with a giggle, it was gone.

Zero floated quietly beside Mira. "You did well," it said. "You didn't change the area. You restored the shape. And the perimeter followed."

"Yes," Mira said. "That tends to work."

Zero blinked. "I was going to say that."

"You were," Mira agreed. "But I thought I'd say it first for once."

Zero was silent for a moment. Then, very quietly, it said: "It does tend to work."

And the wall stood straight and true, six hundred paces around, holding the kingdom safe inside.