How did the battles of Iwo Jima and Okinawa influence the decision to use the bomb against Japan?
The battles of Iwo Jima, along with other similar battles like that on Saipan, influenced the US decision to drop the atomic bombs because they convinced the Americans that an invasion of the Japanese home islands would be horrifically costly in terms of human life. In part because of these battles, the US decided that using the bombs would save huge numbers of lives by ending the war without an invasion.
Iwo Jima and Okinawa were Japanese islands, with Iwo Jima being a very small island with few people. Neither island was part of the home islands that had always been seen as part of Japan. Even so, when the Americans invaded these islands the cost in casualties was tremendous. When the US invaded Iwo Jima, it involved about 70,000 men. Of those, over 6800 were killed and over 19,000 were wounded. Okinawa was a much larger island and about 18,000 men participated in that invasion. More than 12,500 were killed in combat and close to another 39,000 were wounded. In both cases, the Japanese fought essentially to the last man, with 90% or more of their soldiers being killed.
What this showed was that an invasion of the Japanese home islands would be horrible. The Japanese military and even civilians could be expected to defend the islands even more vigorously than they had defended Okinawa or Iwo Jima. Planners estimated that as many as 1 million Americans might get killed and wounded. These calculations made dropping the bombs seem like a much better approach to ending the war.