You can use what the other guy linked, but there’s another way to look at it.

There’s the big main triangle, and then you can also split it into two smaller triangles through the line of length n. All three of these triangles are similar, which you can use to set up ratios between the variables and numbers, then you can solve these ratios like an equation to get your result.