I am trying to solve this inequality for $x$:
$$ \left \lceil{\frac{c_1}{x}}\right \rceil \cdot \left \lceil{\frac{c_2}{x}}\right \rceil \leq N $$
With: $c_1, c_2, x, N \in \mathbb{N}$ and $c_1, c_2, N$ being just constants.
I could make my system work with a solution assuming that $ x \leq c_1, c_2 $ but I would like ot have a general solution if someone can help me. The context behind this equation is how to split an image of $[H,W]=[c_1, c_2]$ in square patches of size $[H_{patch}, W_{patch}]=[x,x]$.
What I have tried yet:
- Solve the equation for the lower bound of each inequality: I does not work.
$$\frac{c_1c_2}{x^2} \leq N \rightarrow \sqrt{\frac{c_1c_2}{N}} \leq x$$
- Solve the equation for the upper bound: I am stuck getting x out of this expression.
$$ (\frac{c_1}{x^2}+1) \cdot (\frac{c_1}{x^2}+1) =\frac{c_1c_2}{x^2} + \frac{c_1}{x} + \frac{c_2}{x} + 1\leq N$$
Forgive my possible mistakes, I am not a mathematician. Thank you for your help in advance.
As discussed in the comments, you need a minimum value for $x$, let's call it $x_{min}$. This is what you mean by lower bound for $x$. I think I also understand what did you mean by upper bound: a "safe" value of $x$ for which the relation is definitely true but could be improved. Let's call it $x_{safe}$.
Your attempt by having $x \leq c_1, c_2$ is just the other way round: $x \geq c_1, c_2$, or as I prefer to denote $x_{safe} = max(c_1, c_2)$. But this is far from $x_{min}$ in cases $N \neq 1$, and you just need to do trial-and-error by brute-force or something to get $x_{min}$ from $x_{safe}$.
First of all, let's make it clear, that if $N = 1$, then $x_{min} = max(c_1, c_2)$.
Secondly, when $N \neq 1$, I can show you how to get $x_{safe}$ closer to $x_{min}$. I can not tell you how to get $x_{min}$ with a formula. You still need to get $x_{min}$ from $x_{safe}$ if you really need the minimum value. To see how it is improving, let $c_1 = 10, c_2 = 4$.
For this, let's look at your attempt on lower bound:
$$\sqrt{\frac{c_1c_2}{N}} \leq x$$
This attempt does not give you $x_{safe}$. You need to increase $x$ until it is OK. Or go with $x_{safe} = max(c_1, c_2) = 10$, which is far.
This can be improved.
Let $\alpha \in \mathbb{R}$. We can have a value for $\alpha$ so that if we only had $\lceil{\frac{c_1}{x}} \rceil \leq N$, $\lceil{\frac{c_1}{\alpha}} \rceil = \frac{c_1}{\alpha} = N \Rightarrow \alpha = \frac{c_1}{N}$, and as we need an integer for $x$, we have $x \geq \alpha \Rightarrow x = \lceil{\alpha} \rceil \Rightarrow \lceil{\frac{c_1}{x}} \rceil \leq \lceil{\frac{c_1}{\alpha}} \rceil = N$.
But we have 2 ceiled expressions. So let's examine if $c_1 = c_2 \Rightarrow {\lceil{\frac{c_1}{x}} \rceil}^2 \leq N$:
let:
$$\frac{c_1}{\alpha} = \sqrt{N} \Rightarrow \alpha = \frac{c_1}{\sqrt{N}}$$
From this:
$$x \geq \alpha \Rightarrow x = \lceil{\alpha} \rceil \Rightarrow x = \lceil{\frac{c_1}{\sqrt{N}}} \rceil \Rightarrow \frac{c_1}{x} = \frac{c_1}{\lceil{\frac{c_1}{\sqrt{N}}} \rceil} \leq {\frac{c_1}{\frac{c_1}{\sqrt{N}}}} = \sqrt{N}$$
So we have $\frac{c_1}{x} \leq \sqrt{N}$, but this does not guarantee $\lceil{\frac{c_1}{x}} \rceil \leq \sqrt{N}$, so still need to adjust to have $x_{safe}$.
$$x = \lceil{\frac{c_1}{\sqrt{N} - 1}} \rceil \Rightarrow \frac{c_1}{x} = \frac{c_1}{\lceil{\frac{c_1}{\sqrt{N} - 1}} \rceil} \leq {\frac{c_1}{\frac{c_1}{\sqrt{N} - 1}}} = \sqrt{N} - 1$$
So we have $\frac{c_1}{x} \leq \sqrt{N} - 1 \Rightarrow \lceil{\frac{c_1}{x}} \rceil \leq \lceil{\sqrt{N} - 1} \rceil < \sqrt{N}$. Now this is OK if $c_1 = c_2$, so one more adjustment, and we have:
$$x_{safe} = \lceil{\frac{max(c_1, c_2)}{\sqrt{N} - 1}} \rceil$$
Because if $c_i = max(c_1, c_2) \Rightarrow \lceil{\frac{c_i}{x_{safe}}} \rceil < \sqrt{N}$ from the above and therefore:
$$c_j \leq c_i \Rightarrow \lceil{\frac{c_j}{x_{safe}}} \rceil \leq \lceil{\frac{c_i}{x_{safe}}} \rceil \Rightarrow \left \lceil{\frac{c_1}{x_{safe}}}\right \rceil \cdot \left \lceil{\frac{c_2}{x_{safe}}}\right \rceil < N$$
If $N = 7$, then $x \geq 6.07... \Rightarrow x = 7 \Rightarrow \left \lceil{\frac{c_1}{x}}\right \rceil \cdot \left \lceil{\frac{c_2}{x}}\right \rceil = 2$, correct. Closer to 4 than 10, but in general I can not show how close it would be. But it is for sure:
$$\lceil{\frac{max(c_1, c_2)}{\sqrt{N} - 1}} \rceil \leq max(c_1, c_2), \sqrt{N} - 1 > 1 \Rightarrow N > 4$$
I leave you to investigate $1 < N \leq 4$
So if you need $x_{min}$ you either use your lower bound formula and keep increasing until its sufficient, or use this upper bound and keep decreasing.