Let $a, b, x, y$ be positive real numbers such that $a+b=1$. Prove that $\frac{1}{\frac{a}{x}+\frac{b}{y}}\leq ax+by$
and find when equality holds.
1. Given \(a, b, x, y\) are positive real numbers such that \(a + b = 1\). We need to prove that:
   \[
   \frac{1}{\frac{a}{x} + \frac{b}{y}} \leq ax + by
   \]
   and find when equality holds.

2. We start by applying the Cauchy-Schwarz inequality in the form:
   \[
   \left( \frac{a}{\sqrt{x}} + \frac{b}{\sqrt{y}} \right)^2 \leq (a + b) \left( \frac{a}{x} + \frac{b}{y} \right)
   \]
   Since \(a + b = 1\), this simplifies to:
   \[
   \left( \frac{a}{\sqrt{x}} + \frac{b}{\sqrt{y}} \right)^2 \leq \frac{a}{x} + \frac{b}{y}
   \]

3. Next, we note that:
   \[
   \frac{a}{\sqrt{x}} + \frac{b}{\sqrt{y}} \geq \sqrt{a^2 \cdot \frac{1}{x} + b^2 \cdot \frac{1}{y}}
   \]
   This follows from the fact that the arithmetic mean is greater than or equal to the geometric mean (AM-GM inequality).

4. Squaring both sides, we get:
   \[
   \left( \frac{a}{\sqrt{x}} + \frac{b}{\sqrt{y}} \right)^2 \geq a^2 \cdot \frac{1}{x} + b^2 \cdot \frac{1}{y}
   \]

5. Combining the results from steps 2 and 4, we have:
   \[
   a^2 \cdot \frac{1}{x} + b^2 \cdot \frac{1}{y} \leq \frac{a}{x} + \frac{b}{y}
   \]

6. Now, consider the expression \(\frac{1}{\frac{a}{x} + \frac{b}{y}}\). By the harmonic mean inequality, we know:
   \[
   \frac{1}{\frac{a}{x} + \frac{b}{y}} \leq \frac{ax + by}{a + b}
   \]
   Since \(a + b = 1\), this simplifies to:
   \[
   \frac{1}{\frac{a}{x} + \frac{b}{y}} \leq ax + by
   \]

7. Equality holds in the Cauchy-Schwarz inequality when the vectors are proportional. In this context, equality holds if and only if:
   \[
   \frac{a}{x} = \frac{b}{y}
   \]
   This implies:
   \[
   ay = bx
   \]

The final answer is \( \boxed{ \frac{1}{\frac{a}{x} + \frac{b}{y}} \leq ax + by } \) with equality if and only if \(ay = bx\).