How can I find the natural numbers $a$ and $b$ such that $a+b<2021$

158 Views Asked by At

I am trying to solve the inequality $a + b <2021$, where $1\leqslant a \leqslant 2023$ and $1\leqslant b \leqslant 2023$, $a$ and $b$ are integer numbers, $a \neq b$. I tried

  • with $a = 1$, then $b\in \{2, 3, \ldots, 2019\}$, there are 2018 numbers.
  • with $a = 2$, then $b\in \{1, 3, 4, \ldots, 2018\}$ , there are 2017 numbers.
  • $a = 2019$, then $b=1$.

Thus, I have $1 + 2 + 3 + \cdots + 2018=2037171$

3

There are 3 best solutions below

1
On BEST ANSWER

Your answer is short by $1009$. First I show how your solution can be proven wrong easily, and then I show how to find the correct solution:
You write the no. of values $b$ can take when $a=1$, $a =2$, .... $a = 2019$, and you add them up. You say it's equal to $1+2+3...+2018$. However, initially, you added $2019$ numbers, but now you're adding only $2018$ numbers. So, there is a mistake in your answer.


$$a+b < 2021$$$$b<2021-a$$Since $a,b \in \Bbb Z$ $$b \le 2020-a$$ We also know $b \ge 1$. So, $b$ can take all values from $1$ to $2020-a$ except $a$ if $a \le 1010$. However, if $a \ge 1011$, then $b$ can take all values from $1$ to $2020-a$ (since $a = b$ is not possible here). So, for $a$ from $1$ to $1010$, you have $2019-a$ values for $b$ and for $a$ from $1011$ to $2019$, you have $2020-a$ values for $b$. Thus, the total number of solutions: $$(2018+2017+...+1010+\color{green}{1009)+(1009}+1008+...+2+1) = \boxed{2038180}$$


Slightly easier approach:
Forget that you have $a \neq b$. Then, like the solution above, you get $1 \le b \le 2020-a$. As $a$ goes from $1$ to $2019$, no. of values for $b$ goes from $2019$ to $1$. Hence, you have $2019+2018+...+2+1 = 2039190$ solutions without the constraint $a \neq b$. You will have exactly $1010$ solutions where $a = b$, which correspond to the ordered pairs $(a,b)$ : $(1,1),(2,2),...,(1009,1009), (1010,1010)$. Subtract $1010$ to get the final answer $$2039190 - 1010 = \boxed{2038180}$$

5
On

If $a+b < 2021 \rightarrow a+b \leq 2020$ , now lets define another nonnegative variable $c$ such that $a+b+c =2020$.

It is given that $1 \leq a,b \leq 2023$ and $a \neq b$. Hence , lets write a sequence such that its exponentials are equal to possible values of $a$ and $b$. This is called as generating functions.

  • $$a=1,2,3,...,2019,2020 \color{red}{\rightarrow} x^1+x^2+x^3+...+x^{2019}+x^{2020}= \frac{x-x^{2021}}{1-x}$$

  • $$b=1,2,3,...,2019,2020 \color{red}{\rightarrow} x^1+x^2+x^3+...+x^{2019}+x^{2020}= \frac{x-x^{2021}}{1-x}$$

  • $$c=0,1,2...,2020 \color{red}{\rightarrow} 1+ x^1+x^2+x^3+...+x^{2019}+x^{2020}= \frac{1-x^{2021}}{1-x}$$

Now , if we find the coefficient of $x^{2020}$ in the expansion of $$\frac{x-x^{2021}}{1-x} \times \frac{x-x^{2021}}{1-x} \times \frac{1-x^{2021}}{1-x} $$ We can find the all possible solutions for $a+b+c=2020$

However , this expansion will also count such cases :

  • $a=1,b=1,c=2018$

  • $a=2,b=2,c=2014$

  • $a=3,b=3,c=2012$

  • ....

  • $a=1009,b=1009,c=2$

  • $a=1010,b=1010,c=0$

So , the answer is $$[x^{2020}]\bigg(\frac{x-x^{2021}}{1-x} \times \frac{x-x^{2021}}{1-x} \times \frac{1-x^{2021}}{1-x}\bigg) - 1010$$

2
On

A summation approach:

We obtain \begin{align*} &\color{blue}{|\{1\leq a\ne b\leq 2023|a+b<2023\}|}\\ &\qquad=|\{1\leq a,b\leq 2019|a+b<2021\}|-|\{1\leq a=b\leq 2019|a+b<2021\}|\\ &\qquad=\sum_{{a+b<2021}\atop{1\leq a,b\leq 2019}}1-\sum_{{a+b<2021}\atop{1\leq a=b\leq 2019}}1\\ &\qquad=\sum_{a=1}^{2019}\sum_{b=1}^{2020-a}1-\sum_{{2a<2021}\atop{1\leq a\leq 2019}}1\\ &\qquad=\sum_{a=1}^{2019}(2020-a)-\sum_{1\leq a\leq 1010}1\\ &\qquad=2020\sum_{a=1}^{2019}1-\sum_{a=1}^{2019}a-1010\\ &\qquad=2020\cdot 2019-\frac{1}{2}2019\cdot 2020-1010\\ &\qquad=2018\cdot 1010\\ &\qquad\,\,\color{blue}{=2\,038\,180} \end{align*} in accordance with the answer from @DS.

A generating function approach:

  • First, we find we can replace the conditions \begin{align*} 1\leq a,b\leq 2023\qquad\text{with}\quad a,b\in\mathbb{N} \end{align*} since we consider \begin{align*} a+b< 2021 \end{align*} which already covers the wanted upper bounds. So, we want to find \begin{align*} &\color{blue}{|\{a,b\in\mathbb{N}|a+b<2021, a\neq b\}|}\tag{1}\\ &\qquad=|\{a,b\in\mathbb{N}|a+b<2021\}|-1010\tag{2}\\ \end{align*}

    In (2) we already separated the number of equal pairs \begin{align*} |\{a,b\in\mathbb{N}|a+b<2021, a= b\}|=1010 \end{align*} to make the derivation a bit easier.

  • Considering sums $a+b$ with $a,b\in\mathbb{N}$ in terms of generating functions translates as \begin{align*} \left(x+x^2+x^3+\cdots\right)\left(x+x^2+x^3+\cdots\right)=\left(\frac{x}{1-x}\right)^2 =\frac{x^2}{(1-x)^2}\tag{3} \end{align*} Since we want to count all solutions of $a+b<2021$ we need to sum up all coefficients $[x^n]$ of (3) with $n<2021$. In terms of generating functions we can sum up the coefficients by multiplying a generating function $A(x)=\sum_{n=0}^\infty a_nx^n$ with $\frac{1}{1-x}$, since \begin{align*} \color{blue}{\frac{1}{1-x}}A(x)=\frac{1}{1-x}\sum_{n=0}^{\infty}a_nx^n=\sum_{n=0}^{\infty}\left(\color{blue}{\sum_{k=0}^n a_k}\right)x^n\tag{3} \end{align*} which can be shown easily using Cauchy multiplication. In order to sum up all coefficients $< 2021$ in (2), we can instead multiply the generating function with $\frac{1}{1-x}$ and extract the coefficient of $x^{2020}$. Using the coefficient of operator $[x^n]$ to denote the coefficient of a series we obtain from (2) and (3): \begin{align*} &\color{blue}{|\{a,b\in\mathbb{N}|a+b<2021, a\neq b\}|}\\ &\qquad=[x^{2020}]\left(\frac{1}{1-x}\,\frac{x^2}{(1-x)^2}\right)-1010\\ &\qquad=[x^{2020}]\frac{x^2}{(1-x)^3}-1010\\ &\qquad=[x^{2018}]\frac{1}{(1-x)^3}-1010\tag{4}\\ &\qquad=\binom{-3}{2018}-1010\tag{5}\\ &\qquad\color{blue}{=\binom{2020}{2}-1010=2\,038\,180}\tag{6} \end{align*}

Comment:

  • In (4) we apply the rule $[x^p]x^qA(x)=[x^{p-q}]A(x)$.

  • In (5) we use the binomial series expansion and select the coefficient $x^{2018}$.

  • In (6) we use the binomial identities $\binom{-p}{q}=\binom{p+q-1}{q}(-1)^q$ and $\binom{p}{q}=\binom{p}{p-q}$.