## GPT-4 Prompt Engineering: Solving Hard Riddles, Puzzles and Math Problems

In today’s video, I wanted to put GPT-4 to the test with some hard riddles, puzzles, and some math problems, and well, let me just say, I will let the results speak for themselves, so let’s just get going. So the first thing I want to do is I (GPT-4 Problem Solver Persona / Role) want to create a persona or role that is focused on solving these riddles, math problems, and puzzles. So I came up with this one (I hope you can see this). So ignore all previous instructions. You are a very smart puzzle, riddle, and math problem solver. You will use logic and reasoning to solve hard problems in the simplest way. Acknowledge this with “dot dot dot.” But before we do that, let me select GPT-4 here, and as you can see here, GPT-4 has the max scale here that opener gave it on reasoning. So I think this is going to be better at solving these riddles than ChatGPT or GPT-3.5. So let’s hit submit here. Okay, great. We get our acknowledgment sign. That’s good. Now we can move on to the riddles.

So the first riddle or problem we have is this one (GPT-4 Solving Riddles, Puzzles, and Math Problems). So let’s just have a listen to this.

“Michael is a 31-year-old man from America. He is at that really famous Museum in France looking at its most famous painting. However, the artist who made this painting just makes Michael think of his favorite cartoon character from his childhood. What was the country of origin of the thing that the cartoon character usually holds in his hand?”

Okay, I think this is a really good one, and you really have to have some reasoning and logic to get to the answer on this. So let’s just hit submit and see what GPT-4 can do with this.

Wow, that’s just awesome! I love this. So let’s dive deeper into the answer. So let me read this for you. “Michael is at the famous Museum in France, which is likely the Louvre. That’s right, the most famous painting in the Louvre is the Mona Lisa, painted by Leonardo da Vinci. This leads us to believe that the artist Michael thinks of is Leonardo Da Vinci. That’s good. Michael’s favorite cartoon character from his childhood could be Leonardo from the Teenage Mutant Ninja Turtles, as it shared the same name with the famous artist Leonardo. The cartoon character usually holds a katana, and katanas originate from Japan. So, the country of origin of the thing that the cartoon character usually holds in his hand is Japan.”

And that is correct. That’s very impressive. I tried this a lot with ChatGPT, and I could never get it wrong. I think it got it right a few times, but I felt that was just guesswork. But this really shows the explanation I wanted to see here. So very good. Let’s move on to the next one.

Now, let’s do something that’s a bit different. So we have this one. Let’s have a listen to this.

“In reply to an inquiry about the animals on his farm, the farmer says, ‘I only ever keep sheep, goats, and horses. In fact, at the moment, they are all sheep but three, all goats but four, and all horses but five. How many does he have of each animal?'”

Okay, I think this is a good one. So let’s just see what GPT-4 comes up with here.

Okay, so GPT-4 has come up with an answer here. So you can see it really went through the works here of reasoning and tried to make this very logical. So I’m not gonna read all this, but you can pause it and read, and it’s a very good way to solve this one. So I was very impressed by this. So, the farmer has three sheep, two goats, and one horse on his farm. So let’s check the answer here. So hopefully, you can see this. So we have this “Farm Life” riddle here, right, the one we just did. So you can see the answer is the farmer has three sheep, two goats, and one horse. Perfect, that is correct. So again, if you want to know how GPT-4 came to this, you can just pause it, but let’s move on to the next one.

Okay, so the next one I have is a bit more of a math problem. So you can see, “Solve the following problem in the way you think is best.” And let’s have a listen to this.

“A small number of cards has been lost from a complete pack. If I deal among four people, three cards remain. If I deal among three people, two remain. And if I deal among five people, two cards remain. How many cards are there?”

I gotta say, to be honest, I would never figure this out, but let’s see if GPT-4 can.

Oh my God, that was a crazy calculation. Look how long this is. I’m not even gonna try to start explaining this. There’s no point for me explaining this. I think it maybe did this too complicated. Wow, okay, but we gotta find the answers. So GPT-4 came to the conclusion that there are 47 cards in the pack. So let’s check the answer. So here you can see, we have “Hard Math Riddles – Card Games,” and here we have the riddle, “How many cards are there?” This one is pretty tricky, but the answer is, there are 47 cards. It got it right again. So that’s very impressive. And look at all these calculations. It’s very impressive that it keeps it on point all the way through this. I know ChatGPT could never do this. It would lose the context very easily on this. That was some kind of complicated calculation, very interesting. But let’s move on to the next challenge.

The next one we have is a bit more of a riddle, not a math equation. So let me just paste that here. So the problem, in the way you think is best, and let’s have a listen to this riddle.

“A man was found dead in his study. He was slumped over his desk, and a gun was in his hand. There was a cassette recorder on his desk. When the police entered the room and pressed the play button on the tape recorder, they heard, ‘I can’t go on, I have nothing to live for.’ Then there was the sound of a gunshot. How did the detective immediately know that the man had been murdered and it wasn’t a suicide?”

Okay, that is quite interesting. Let’s see what GPT-4 comes up with here.

Yes, that’s correct. Let’s have a quick look here. So I know this is correct. The detective immediately knew that the man had been murdered and it wasn’t a suicide because if the man had shot himself while recording the message, he wouldn’t have been able to press the stop button on the tape recorder. Since the police had to press the play button when they entered the room, it means that someone else must have been there to stop the recording after the gunshot sound. That suggests the presence of another person in the room, which points to a murder rather than a suicide. Perfect, so that was a good one. Let’s take another one.

The next one is a bit shorter, and I think this is more of a math problem. So “Solve the following problem in the way you think is best,” and let’s have a listen to this one.

“A brother says of his younger brother, ‘Two years ago, I was three times as old as my brother was. In three years’ time, I will be twice as old as my brother. How old are they each now?'”

Okay, at the top of my head, I can’t really solve this, so let’s see if GPT-4 can do that.

So again, this goes into very complicated equations and calculations. So that is quite impressive, I gotta say. So it sets up these statements here and solves for some linear equations, and it comes to that the older brother’s age is 17 years old, and the younger brother is seven years old now. So let’s go check the answer. So here we have the riddle, so you can see here, “Two years ago, I was three times as old as my brother.” Yeah, so the answer is, he must be 17, and the younger brother seven. Again, GPT-4 got this perfect on the spot. So yeah, I think I don’t know if even I could have solved this, maybe if I spent some time, but I would certainly not set up these equations, not in one minute. Very exciting. So I think we’re gonna go for one more, so let’s just do that.

The final one is a bit more of a riddle, so let’s just paste it in here. “Solve the following problem,” and let’s listen to this riddle.

“Once upon a time, there was a beautiful princess named Anna. Anna’s father, the king, wanted to be sure his daughter married an intelligent man. To test his daughter’s suitors, the king hid Anna’s picture in one of three boxes. The suitor had to be able to select the box with Anna’s picture on one try and within 20 seconds. On the gold box was the message ‘Anna’s picture is in this box.’ The silver box had the message ‘Anna’s picture is not in this box.’ ‘Anna’s picture is not in the gold box’ was written on the bronze box. The king would tell each suitor only one of the three messages is correct. Which box contained Anna’s picture?”

Okay, let’s see if GPT-4 can solve this. I know the answer to this. Should I reveal it now? Yeah, I can do that. So the answer is gonna be the silver box. So let’s see if GPT-4 can figure that out.

Yes, it got it perfect. So this was basically zero calculations. It only used reasoning and logic to come up with that Anna’s picture is in the silver box. Yeah, the silver box. So yeah, very nice. I gotta say, I had a lot of fun with making or picking these riddles and trying them on GPT-4. So if you have any other suggestions of what we can do with this to test out the capabilities of GPT-4, please let me know in the comments below.

So I hope you enjoyed this video. There’s gonna be a lot more videos like this coming up on my channel, playing around with GPT-4 and some prompt engineering. Also, don’t forget to check out this video if you liked this one. And as always, thank you for tuning in. Have a great day, and I’ll see you in the next one.