Why did Mexico lose half its territory?

How and why did Mexico lose more than two million and 500,000 square kilometers of its territory?

Why did Mexico lose half its territory?
Texas trouble. Image: Public domain