<s>[INST] Max of $ax+by$ given that $x^2+y^2 \le 1$ If a and b a positive real numbers find the maximum value of ax+by in terms of a and b given that $x^2+y^2 \le 1$.
I started by letting $k = ax+by$ giving the line $y=\frac{-ax}{b} + \frac{k}{b}$. Now we want to find the largest value of k such that the line still intersects the unit circle. Graphically it can be seen that this occurs when the line is tangent to the circle. This results in a right triangle with $\frac{k}{b}$ as the hypotenuse and 1 as one of the side lengths. This is where I am stuck because in the solution they had the following triangle;

How do we know that the other side length of the triangle is the gradient of the line?
 [/INST] Applying Cauchy-Schwarz Inequality
$$(ax+by)^2\leq (a^2+b^2)(x^2+y^2)\leq (a^2+b^2) \times 1 =(a^2+b^2)$$
$$ax+by \leq \sqrt{a^2+b^2}$$
</s>