In how many ways can we rearrrange the digits: $0,1,2,\ldots,9$ if the first digit should be $>1$ and the last one $<8$? In how many ways can we rearrrange the digits: $0,1,2,\ldots,9$ if the first digit should be $>1$ and the last one $<8$?
Given answer by the book : $10! - 2 \cdot 9! - 2 \cdot 9! + 4 \cdot 8!$ .

I probably miss something here. My approach: There are $3$ ways to violate the constraints


*

*If the first digit is $\leq 1$ . Then we have $2$ choices for the first digit, $8$ for the last one ( since it's less than $8$, the last digit $\in [0,7]$, and since we picked already two digits out of $10$ available there are $8 \cdot 7 \cdot 6 \ldots \cdot 1 = 8!$ for the other digits of the arrangement . In total : $N(c1)=2 \cdot 8 \cdot 8!$

*If the 10th digit is $\geq 8$ . This can happen in two ways ($8$ or $9$), we also have $8$ choices for the first one and $8!$ for everything else . In total : $N(c2)=2 \cdot 8 \cdot 8!$

*Both 1 and 2 cases :  If the first digit is $\leq 1$ and the 10th digit is $\geq 8$  . This can happen in $N(c1 \wedge c2)=2 \cdot 2 \cdot 8!$ ways.

Without constraint : $10!$

Hence , from inclusion - exclusion principle There are  \begin{align*} N(c1 \lor c2)) & = N - (N(c1) + N(c2) - N(c1 \wedge c2))\\ & = 10! - 2 \cdot 8 \cdot 8! -2 \cdot 8 \cdot 8! + 2 \cdot 2 \cdot 8!\\ & = 10! - 2 \cdot 8 \cdot 8! -2 \cdot 8 \cdot 8! + 4 \cdot 8!\end{align*}

With the help of some fellow people here , I realised my mistake: If I want to define the fact $N(c1)$ as the case where only the first and only this digit violates the constraint then sure I can do it as long as  I then write $ N(c1 \wedge c2) = 0$. Otherwise, we can define $N(c1)$ as the case where the first digit violates the constraint without wondering about the last and after we make sure we don't count twice, since $N(c1 \wedge c2) = 0$ this time
 A: Your first is not simply the number of arrangements that violate the restriction on the first digit: it’s the number that violate that restriction and do not violate the restriction on the last digit. Similarly, your second calculation yields the number of arrangements that violate the condition on the last digit but not the condition on the first digit. This approach does not count any unwanted arrangement twice, so the total number of acceptable arrangements is simply $10!-2\cdot8\cdot8!-2\cdot8\cdot8!$, and this is indeed the same as the answer given:
$$\begin{align*}
10!-2\cdot8\cdot8!-2\cdot8\cdot8!&=(90-16-16)\cdot8!\\
&=58\cdot8!\\
&=(90-18-18+4)\cdot8!\\
&=10!-2\cdot9!-2\cdot9!+4\cdot8!\,.
\end{align*}$$
In the answer that you were given, the first $2\cdot9!$ is the number of arrangements that violate the condition on the first term whether or not they also violate the condition on the last digit, and the second is the number that violate the condition on the last term whether or not they also violate the condition on the first digit. When you do the calculation this way, you do count each arrangement that violates both conditions twice, so you have to add those back in; that’s what the $4\cdot8!$ term does.
