The Mathematical Ninja peered at the problem sheet:

 

Given that $(1+ax)^n = 1 - 12x + 63x^2 + \dots$, find the values of a and n

 

Barked: “$n=-8$ and $a=\frac{3}{2}$.”

The student sighed. “I get no marks if I just write down the answer.”

Snarled: “You get no scars if you don’t talk back.”

“Are you going to teach me your secrets, oh all-knowing sensei?” The Mathematical Ninja, the student had learned, had one weakness: the inability to detect sarcasm.

“$n$ is simply $\frac{2\times 63}{(-12)^2 - 126}$, which is 8.”

“No, you’ll need to run through that a bit more slowly.”

Under their breath: “Only one thing getting run through around here, sunshine, and the only slow thing will be your demise.” Aloud: “Fine, fine, fine. I shall break it down into simpler slices.” Slices. Now there was a thought.

“You’re too kind, sensei.”

“We know that $an = -12$ and $\frac{1}{2}a^2n(n-1) = 63$, because even you understand the binomial expansion.”

The student pretended this was the case.

“If I square the first and double the second, I get $a^2 n^2 = 144$ and $a^2n(n-1) = 126$.”

“Which you can divide to get rid of the $a$?”

“Indeed. $\frac{n(n-1)}{n^2}$ - or rather, $\frac{n-1}{n} = \frac{126}{144}$.”

“And you could simplify that to $\frac{7}{8}$ and read off the answer?”

“In this case, yes, but generally you might not get a nice fraction. In the more general case, if you had $1 - Ax + Bx^2 + \dots$, you would end up with $\frac{n-1}{n} = \frac{2B}{A^2}$. That’s equivalent to $1-\frac{1}{n} = \frac{2B}{A^2}$, or $\frac{1}{n} = \frac{A^2 - 2B}{A^2}$.”

“And you can flip that to get your answer!”

The Mathematical Ninja restrained themself from flipping a table. “$n$ is indeed $\frac{A^2}{A^2 - 2B}$, yes. And here, that’s $\frac{144}{144-126}$; and everyone knows that $144$ is eight eighteens.”

“Everyone, sensei. Absolutely everyone.”

* Edited 2019-08-26 after the Ninja pointed out that I’d mis-transcribed their original answer. I am typing this with nine fingers. It won’t happen again.