Skip to content

Instantly share code, notes, and snippets.

@theredpea
Created October 25, 2023 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theredpea/cfe6cf2d3ab8cbfed2ec165d4450e61f to your computer and use it in GitHub Desktop.
Save theredpea/cfe6cf2d3ab8cbfed2ec165d4450e61f to your computer and use it in GitHub Desktop.
Equilateral Triangles Overlap Area.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyNwhdCnlMdqcw2r7dmGgWjs",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/theredpea/cfe6cf2d3ab8cbfed2ec165d4450e61f/equilateral-triangles-overlap-area.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"These tweets propose a math/geometry/trigonometry puzzle.\n",
" - [Original puzzle tweet from Diego Rattaggi @diegorattaggi and inspired by Michael Penn](https://twitter.com/diegorattaggi/status/1450903893899202575)\n",
" - [Solution tweet from Per Henrik Christiansen @PerHenrikChris1](https://twitter.com/PerHenrikChris1/status/1583101619344146433)\n",
"\n",
"Here is the original puzzle:\n",
"\n",
"<img src=\"https://pbs.twimg.com/media/FCKlZAdX0AYKAOn?format=png&name=4096x4096\" alt=\"Two equilateral triangles overlap (one of them is flipped 180 degrees) so the intersections of their points and edges form the diagonal of a square\" width=\"400\"/>\n"
],
"metadata": {
"id": "YbCmZK4A3dMA"
}
},
{
"cell_type": "markdown",
"source": [
"\n",
" Here is a helpful diagram I use to help understand the solution from Per...\n",
"\n",
"Per's solution is posted on [desmos, here](https://t.co/QAwd41j8G5). In my diagram below, I use Per's conventions where:\n",
"- $S$ is the length of the \"main\" equilateral triangle\n",
"- $s$ is the length of the square formed in the overlap\n",
"- $d$ is a diagonal of the square\n",
"- $X$ is the length of the \"medium\" equilateral triangle **whose height is $s$**\n",
"- $(S-X)$ is the length of the \"small\" equilateral triangle excluded by the square\n",
"\n",
"<img src=\"https://drive.google.com/uc?export=view&id=1vuJXcnQS52-aRG68QY5LQb0vzMahHTF4\" alt=\"Measuring some angles from the equilateral triangles in above example\" width=\"400\"/>\n",
"\n",
"\n",
"I get stuck when Per says this:\n",
"$$\n",
"s=\\frac{S\\sqrt{3}}{2\\sqrt{2}\\cos15}\n",
"$$\n",
"\n",
"<img src=\"https://drive.google.com/uc?export=view&id=1ougmQolOhDIw51nmogKMHreYsAs6efXF\" alt=\"Per's solution on desmos \" width=\"600\"/>\n",
"\n"
],
"metadata": {
"id": "xiFJiDqoo9vY"
}
},
{
"cell_type": "markdown",
"source": [
"Let's try it...\n",
"\n",
"We have two ways of calculating the diagonal length $d$. We use the [law of sines](https://en.wikipedia.org/wiki/Law_of_sines), which is an \"equation relating the lengths of the sides of any triangle to the sines of its angles\", (nicely explained [here](https://youtu.be/4Dv5IFqATrc?t=490))\n",
"\n",
"\\begin{align} \\tag{1}\n",
"d&=(S-X) \\frac{\\sin{120}}{\\sin{15}} \\\\\n",
"\\\\\\tag{2}\n",
"d&=X\\frac{\\sin{120}}{\\sin{45}} \\\\\n",
"\\end{align}\n",
"\n",
"Then we can rearrange equation 2 to get the value of $X$:\n",
"\\begin{align}\n",
"\\\\\n",
"X&=d\\frac{\\sin{45}}{\\sin{120}} \\\\\n",
"\\end{align}\n",
"\n",
"Now substitute the value of $X$ into equation 1, and isolate $d$ on the left side of the equation, and $S$ on the right side...\n",
"\\begin{align}\n",
"\\\\\n",
"d&=(S-d\\frac{\\sin{45}}{\\sin{120}}) \\frac{\\sin{120}}{\\sin{15}} \\\\\n",
"\\\\\n",
"d\\frac{\\sin{15}}{\\sin{120}}&=S-d\\frac{\\sin{45}}{\\sin{120}} \\\\\n",
"\\\\\n",
"d\\sin{15}&=S\\sin{120}-d\\sin{45} \\\\\n",
"\\\\\n",
"d\\sin{15} + d\\sin{45}&=S\\sin{120} \\\\\n",
"\\\\\n",
"d(\\sin{15} + \\sin{45})&=S\\sin{120} \\\\\n",
"\\end{align}\n",
"\n",
"Now for the left side of the equation, use the [\"sum and product formulae\"](https://openstax.org/books/precalculus-2e/pages/7-4-sum-to-product-and-product-to-sum-formulas) to convert the **sum** $\\sin{15} + \\sin{45}$ into a **multiplication** of $\\sin$ and $\\cos$... (Note the [\"sine angle addition identity\"](https://youtu.be/R0EQg9vgbQw), aka the [\"compound angle formulae\"](https://www.liverpool.ac.uk/~maryrees/homepagemath191/trigid.pdf) did not apply here; that would apply if we were handling $\\sin{(15 + 45)}$ )\n",
"\n",
"For the right side of the equation, use the [\"cofunction identities\"](https://openstax.org/books/precalculus-2e/pages/7-2-sum-and-difference-identities) that $\\sin{\\theta} = \\cos{\\frac{\\pi}{2}-\\theta}$\n",
"\n",
"\\begin{align}\n",
"d(2\\sin{\\frac{15+45}{2}}\\cos{\\frac{15-45}{2}})&=S\\sin{120} \\\\\n",
"\\\\\n",
"d(2\\sin{30}\\cos{-15})&=S\\cos{90-120} \\\\\n",
"\\\\\n",
"d(2\\sin{30}\\cos{15})&=S\\cos{30} \\\\\n",
"\\\\\n",
"d&=\\frac{S\\cos{30}}{(2\\sin{30}\\cos{15})} \\\\\n",
"\\end{align}\n",
"\n",
"Now remember some basic values on [the unit circle](https://openstax.org/books/precalculus-2e/pages/7-2-sum-and-difference-identities), $\\cos{30}=\\frac{\\sqrt{3}}{2}$ and $\\sin{30}=\\frac{1}{2}$ to find the length of $d$\n",
"\n",
"\\begin{align}\n",
"\\\\\n",
"d&=\\frac{S(\\frac{\\sqrt{3}}{2})}{(2\\frac{1}{2}\\cos{15})} \\\\\n",
"\\\\\n",
"d&=\\frac{S\\sqrt{3}}{2\\cos{15}} \\\\\n",
"\\\\\n",
"\\end{align}\n",
"\n",
"Then remember that you can calculate [the area of a square from its diagonal $d$](https://byjus.com/maths/area-of-square-using-diagonal/), and the area of the square from its side $s$, so set the areas to equivalent values to express $s$ in terms of $S$...\n",
"\n",
"\\begin{align}\n",
"\\frac{1}{2}d^2&=\\frac{1}{2}(\\frac{S\\sqrt{3}}{2\\cos{15}})^2 = s^2\\\\\n",
"\\\\\n",
"s&=\\sqrt{\\frac{1}{2}(\\frac{S\\sqrt{3}}{2\\cos{15}})^2} \\\\\n",
"\\\\\n",
"s&=\\sqrt{\\frac{1}{2}}\\frac{S\\sqrt{3}}{2\\cos{15}} \\\\\n",
"\\\\\n",
"s&=\\frac{S\\sqrt{3}}{2\\sqrt{2}\\cos{15}} \\\\\n",
"\\end{align}"
],
"metadata": {
"id": "k9nmLAYG3kdt"
}
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "JLnEbYaq3tcH"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment