Question regarding number congruences? First of all, before the question, I want to clear that how does $17x \equiv 1 \pmod 4 $ imply $x \equiv  1 \pmod 4$? I did: 
$17x \equiv 1 \pmod 4 $ 
$16x \equiv 0 \pmod 4$ 
Subtracting both, We get the desired result? Is it the right way or there is a shorter method?
Now the question is to design a test for the divisibility of a number by 7,11 or 13 using number congruences. 
So my book says that: 
Let $n$ be a positive integer, then we may write $n$ as $n \equiv  a_0 + a_1(1000) + \ldots + a_k(1000)^k$ where $0 \leq a_i \leq 1000$ or $i = 0,1,2, \ldots, k$. We note that $1001 = 7\cdot11\cdot13$ therefore 
$1000\equiv  -1 \pmod 7$ 
$1000\equiv  -1 \pmod {11}$  
$1000\equiv  -1 \pmod {13}$ 
This gives $n \equiv  a_0 - a_1 + a_2-\cdots + (-1)^ka_k \pmod  n$ for $n = 7, 11, 13.$ 
Now does the writer derive the last expression? Please help!

The author derives it from some basic properties of congruences.
(1)
$1000 \equiv -1 \pmod 7$
So it follows that:
$1000^k \equiv (-1)^k \pmod 7$
The same is true for modulo 11 and 13.
(2) 
If $a \equiv b \pmod n$, and if 
$a \equiv b \pmod m$
and if $(n,m)=1$, it follows that 
$a \equiv b \pmod {nm}$ 
What the author did follows from the basic properties of congruences and of the operations one can do with them. There's nothing fancy here.  
So the rule is the following: a number is divisible by 7/11/13 if the sign-alternating sum of its digits (in base 1000) is divisible by 7/11/13.
EDIT: This part should read
This gives $n \equiv  a_0 - a_1 + a_2-... + (-1)^ka_k \pmod m $ for $m = 7, 11, 13.$
I guess that's what confused you. 
In fact (2) is not used by the author.
EDIT: When you have a congruence $ax \equiv b \pmod n$ (a,b,n are given, x is a variable), and if (a,n)=1, there's a theorem saying that this congruence is satisfied by exactly one number x from the set {0, 1, ... , n-1}. The author simply gave you this number saying that it's 1. So based on this theorem, there's no other one but x=1. AFAIK, one can only find the solution (for x) by trying all numbers from the set. Your approach seems nice too, but it won't work always, I think. 
