You have given the correct answer to the following question: how many permutations are there in which $k$ is smaller than all the numbers to its right and larger than all the numbers to its left. However the last part was not specified in the question you asked. For example if $n=7$ and $k=3$ then
is an allowable permutation, but you will not have counted it.
Hint. First determine which places $k$ can occupy. If $j$ is such a place then
- there are $n-k$ numbers larger than $k$, and you have to choose $n-j$ of them, in a particular order, to occupy the places to the right of $k$;
- There are now $j-1$ numbers which have to be placed in a particular order to the left of $k$.
So the answer will be
- see if you can fill in what is missing.
On second thoughts here is another argument which leads directly to the answer you were given.
- Choose (without regard to order) the places to be occupied by the numbers $1,\ldots,k$.
- Choose the order for these numbers, remembering that $k$ must be last.
- Order the remaining $n-k$ numbers into the remaining $n-k$ places.
Best of all: the answer you were given simplifies to
Here is an argument which gives this result immediately. There are $n!$ permutations of the numbers altogether, and we determine the proportion of them which satisfy your conditions. As in my second solution, the only thing that matters is that $k$ should be the last of the numbers $1,\ldots,k$ to appear in the permutation: as long as this is true, the locations of the larger numbers don't matter. Among all orderings of the numbers $1,\ldots,k$, the number $k$ occurs with equal frequency in each of the $k$ places; so the proportion in which it occurs last is $1/k$, and the number of permutations of $1,\ldots,n$ in which this occurs is