# A Poincaré-type inequality: proof or counterexample

The following is a simplified version of a Poincaré-type inequality that I'm studying; I'd like to prove it (the inequality) or find a counter example. Consider a function $f:[0,1]^2\rightarrow\mathbb{R}$ that is square-integrable with square-integrable first partial derivatives. Define $$g(x) =\int_0^1 f(x,y)\,dy.$$ For notation, let $f_x$ and $f_y$ be the partials of $f$ with respect to $x$ and $y$, respectively. Here is the inequality: $$\int_0^1 \int_0^1 (f(x,y)-g(x))^2\,dy\,dx \;\leq\; C\,\left( \int_0^1\int_0^1 \frac{f_y(x,y)^2}{f_x(x,y)^2 + f_y(x,y)^2}\,dy\,dx \right)\,\times \left( \int_0^1\int_0^1 f(x,y)^2 + f_x(x,y)^2 + f_y(x,y)^2\,dy\,dx \right),$$ for some constant $C$ that is independent of $f$.

For some context, the first integral term on the right hand side is the average proportion of the gradient "energy" attributable to the $y$ variable. The second integral term is the squared $H^1$ norm of $f$. The left hand side is the average squared error in a particular univariate approximation of the bivariate function $f$.

In searching for counterexamples, I tried functions of just $x$ and just $y$, linear functions, and quadratic functions. All satisfied the inequality. I started to try functions of the form $x^py^q$ but got stuck in Mathematica.

I have searched several references (e.g., Pachpatte, Mathematical Inequalities; Saloff-Coste, Aspects of Sobolev-Type Inequalities; Heinonen et al., Sobolev Spaces on Metric Measure Spaces) and not found anything close. I tried to modify a proof of a very simple Poincaré inequality (Theorem 4.2.1 in Pachpatte) with no luck; Cauchy-Schwarz pointed the wrong way.

To get some intuition, I'm adding a plot for @fedja's proposed counter example below. Maybe I'm missing something but it looks to me that is false in general. Take $f(x,y)=\max[(1+y)(1-Ax)_+,A^{-1}(1-x)]$ with big $A>0$. Then the LHS is about $A^{-1}$ while the RHS is about $A^{-2}$.