Let the smallest angle of the 3-4-5 triangle have measure α, the smallest angle of the 5-12-13 triangle have measure β, and the smallest angle of the third triangle have measure γ. It is given that α+β+γ=90∘, so cos(α+β+γ)=0. Expanding gives
cos(α+β+γ)=cos(α+β)cosγ−sin(α+β)sinγ=(cosαcosβ−sinαsinβ)cosγ−(sinαcosβ+cosαsinβ)sinγ=cosαcosβcosγ−sinαsinβcosγ−sinαcosβsinγ−cosαsinβsinγ=0.
Because sinα=53, cosα=54, sinβ=135, and cosβ=1312,
cos(α+β+γ)=54⋅1312cosγ−53⋅135cosγ−53⋅1312sinγ−54⋅135sinγ=6548cosγ−6515cosγ−6536sinγ−6520sinγ=6533cosγ−6556sinγ=0.
Therefore 33cosγ=56sinγ, so tanγ=5633. Because 33 and 56 are relatively prime, perhaps they are the lengths of the two legs of the third triangle. Indeed, 332+562=1089+3136=4225=652, and the perimeter of the triangle is 33+56+65=154.
Let α, β, and γ be as in the first solution. Using complex numbers in polar form, note that 4+3i=5 cis α. Similarly, 12+5i=13 cis β. Multiplying these two quantities yields
(4+3i)(12+5i)=33+56i=65 cis (2π−γ),
where the triangle with sides of length 33, 56, and 65 has angle γ opposite the side of length 33 and angle 2π−γ opposite the side of length 56. Notice that
(5cisα)⋅(13cisβ)⋅(65cisγ)=(4+3i)(12+5i)(56+33i)=652i=652cis(α+β+γ)=652cis2π.
The third triangle has sides of length 33, 56, and 65, and 33+56+65=154.