How do you find Pythagorean triples that approximately correspond to a right triangle with a given angle? Given an angle $\theta$, can I find a Pythagorean triple $(A,B,C)$ such that the corresponding right triangle contains an angle that is as close to $\theta$ as I want? And if so, how? For example suppose $\theta = 56.25^\circ$. How do I find Pythagorean triples $(A,B,C)$ such that $\tan(56.25^\circ) \approx B/A$? Looking at Euclid's formula this is the same as asking for coprime not-both-odd integers $m$ and $n$ such that $$\tan(56.25^\circ) \approx \frac{2mn}{m^2-n^2}\,$$ but this only makes a brute-force search easier. Is there a procedural way to generate such arbitrarily precise triples?
 A: This works for
$\quad 0.01 \lt \tan\theta\lt 1\quad$
being limited to decimals expressible as $3$-digit fractions.
For  $\tan\theta>1,\space \tan\space (90-\theta)\space$ should be used.
For $\tan\theta=1,\space$ the best triples are where $A^2+(A\pm1)^2=C^2.\quad$
We begin with Euclid's formula
$$ A=m^2-k^2\qquad B=2mk \qquad C=m^2+k^2$$
For $\tan\theta = 1,\space$ the values for
$A^2 +(A\pm1)^2=C^2\space$ triples (to feed $(m,k)$-values to Euclid's formula) may be generated sequentially with
$k_{n+1}=k_n+\sqrt{2k_n^2+(-1)^{k_n}}.$ These are pell numbers $\{1,2,5,12,\cdots\}$ to be used in pairs like $\space(2,1),\space (5,2),\space (12,5)\cdots.\space$ For $\tan\theta<1,\space$ we use these steps

*

*Convert tangent to a $1$-to-$3$ digit fraction to identify the A:B ratio.


*Solve the tangent function for $k$


*Test a range of $m$-values to see which yields a
$k$-value closest to an integer,


*Use $m$ and the rounded value of $k$ to generate the triple with Euclid's formula.
\begin{equation}
\tan\theta=\dfrac{A}{B} 
= \dfrac{m^2-k^2}{2mk}\\
\\ 2mkA=(m^2-k^2)B\\
\\ B k^2+2 A k m  - B m^2 = 0
\\
\implies 
k = \dfrac{\sqrt{A^2 m^2 + B^2 m^2} - A m}{B}\\
 \quad \text{ for }\quad
2
\le m \le 
50
\end{equation}
This range is chosen to accommodate fractions up to $3$ digits.
Example
$$\tan39^\circ\approx 0.80978\approx \dfrac{149}{184} 
\implies A=149\quad B=184$$
$$k = \dfrac{\sqrt{149^2 m^2 + 184^2 m^2} - 149 m}{184}
 \quad \text{ for } 2\le m \le 30
\\\text{and we find the best fit is }
\quad m=21\quad k\approx 10.016\approx 10
 \\ 
f(21,10)=(341,420,541)\\ 
\tan\theta\approx\dfrac{341}{420}\approx 0.81190476 
\\ \tan^{-1} 0.81190476\approx 39.07^\circ
$$
A: For any positive integer $m>n$,
\begin{gather}
z=m+ni= r\angle \phi\\
z^2=(m+ni)^2=(m^2-n^2)+2mni=r^2\angle 2\phi
\end{gather}
where $r=\sqrt{m^2+n^2}$ and $\tan \phi=\frac{n}{m}$.
Thus $\{m^2+n^2,m^2-n^2,2mn\}$ is a Pythagorean triplet.
In your case $2\phi=56.25^\circ$ or $\phi=28.125^\circ$.
Find the simplest $m>n$ such that $\tan 28.125^\circ=\frac{n}{m}$.
\begin{align}
\tan 28.125^\circ&=\frac{n}{m}\\
0.5&\approx\frac{n}{m}\\
\end{align}
$m=2$ and $n=1$.
A: Let $r\in[0,\infty)$. The problem posed is equivalent to finding $m\geq n\in\mathbb N$ such that $r\sim\frac{2mn}{m^2-n^2}$.
Thus, we want $$rm^2-2mn-rn^2\sim0$$Now suppose $r,n$ is given and we want to find $m$ that satisfies the equation above (not necessarily natural).
Thus, $$m=\frac{n\left(1+\sqrt{1+r^2}\right)}r$$So, we want to find a choice of $n$ that makes the expression above arbitrarily close to an integer.
But that's relatively easy. Let $c=\frac r{1+\sqrt{1+r^2}}$. Thus, $n=mc$. So, we just want to find a fraction $\frac nm$ close to $c$. Easy!
Summary:
Given $\theta$, compute $$c=\frac{\sin\theta}{1+\cos\theta} = \tan\frac\theta2$$Then, find a fraction $\frac nm$ arbitrarily close to $c$. Substitute $m,n$ into your formula and voila!
A: For an angle $\theta$ you can find a Pythagorean triple $(2mn, |m^2-n^2|, m^2+n^2)$ corresponding to a right triangle containing an angle about $\theta$ by find a rational approximation $$\frac{m}{n} \approx \tan\frac{\theta}{2}$$
You can find a "good" rational approximation to $\tan\frac{\theta}{2}$ using techniques from this Q&A post. Note that
Don Thousands' answer is the inspiration for this realization; I wanted to express it compactly.
