ABC is a right triangle with AB = 2, BC = 3\sqrt{5}, AC = 7 and \angle ABC = 90^\circ. If \cos \angle BAC = \frac{a}{b}, where a and b are coprime positive integers, what is the value of a + b?

To find the value of \(\cos \angle BAC\), we can use the cosine formula for a right triangle.

The cosine formula states that for any triangle ABC:

\(\cos \angle BAC = \frac{AB^2 + AC^2 - BC^2}{2 \cdot AB \cdot AC}\)

In our case, AB = 2, BC = 3√5, and AC = 7. Substituting these values into the formula, we get:

\(\cos \angle BAC = \frac{2^2 + 7^2 - (3\sqrt{5})^2}{2 \cdot 2 \cdot 7}\)

Simplifying further:

\(\cos \angle BAC = \frac{4 + 49 - 45}{28}\)
\(\cos \angle BAC = \frac{8}{28}\)
\(\cos \angle BAC = \frac{2}{7}\)

Therefore, the value of \(\cos \angle BAC\) is \(\frac{2}{7}\), and the sum of a and b is 2 + 7 = 9.