How many three digit numbers of the form $xyz$ are there such that $x<y>z$

How many three digit numbers of the form $$xyz$$ are there such that $$xz$$?

So, it's obvious from the question that $$x \ne 0$$, so even $$y\ne0$$.

My approach: I counted.

$$x$$ $$y$$ $$z$$
$$1$$ $$2$$ $$0,1$$
$$1,2$$ $$3$$ $$0,1,2$$
$$1,2,3$$ $$4$$ $$0,1,2,3$$
$$1,2,3,4$$ $$5$$ $$0,1,2,3,4$$
$$1,2,3,4,5$$ $$6$$ $$0,1,2,3,4,5$$
$$1,2,3,4,5,6$$ $$7$$ $$0,1,2,3,4,5,6$$
$$1,2,3,4,5,6,7$$ $$8$$ $$0,1,2,3,4,5,6,7$$
$$1,2,3,4,5,6,7,8$$ $$9$$ $$0,1,2,3,4,5,6,7,8$$

After I counted all cases, I got:

$$80+70+60+50+..+10$$ which gives $$360$$. But the answer given is $$240$$. Can someone confirm if my method is correct? Is there a shorter method to do this?

• Where are you getting the numbers in your sum? For example, the only qualifying numbers I see with $y=2$ are $121$ and $120$. I think that's probably your mistake. May 12, 2021 at 9:09

You have to count all possible combinations of numbers from both first and third column in your table. For example, when $$y=2$$, you have only one possible value of $$x$$, and two possible values of $$z$$. Thus, the number of possible combinations is $$1*2=2$$. Proceeding the same way with the rest of the rows, we obtain:

$$1*2+2*3+3*4+4*5+5*6+6*7+7*8+8*9=240$$

Using your method, the number is

$$\sum_{i=1}^n i(i+1)=\frac{n(n+1)(2n+1)}{6}+\frac{n(n+1)}{2}=\frac{n(n+1)}{6}(2n+4)=\frac{8(9)(10)}{3}=240$$

where $$n=8$$.

I think you could do it in an easier way. Take two cases:

1. $$x$$,$$y$$, and $$z$$ are distinct. Choose these from the set $$A=\{1,2,3,...,9\}$$. You have $$\binom {9}{3}$$ choices. Once chosen, each combination gives $$2$$ numbers. So, you have $$2 \binom {9}{3}$$ numbers. Now, take the case where $$z=0$$ and choose $$x,y$$ from the set $$A$$. I leave the calculation to you, it is quite elementary and in the same manner as I showed.
2. Where $$x=z$$. Here, choose $$2$$ numbers from $$A$$, and for every choice, there is only one $$3$$-digit number that can be formed from these digits satisfying the given condition(once you've chosen two numbers, the greater becomes $$y$$ and the smaller one is $$x=z$$. Arrangement can only be done in one way.