User:Darcourse/sandbox

Balancing a disc


Let the triple $$(\theta_i, d_i, w_i)$$ be the angle, distance and weight of a particle from the centre of the disc.

Let P be some particles on a unit disk such that a given diameter axis $$d_1$$ means that the sum of perpendiculars from P to $$d_1$$ is zero. Let $$d_2$$ be a distinct other axis with the same property.

Prove that all $$d$$ have this property.

Consider two axis orthogonal to each other and a set of weights with the above property (which can be achieved by calculating the position of the $$n^{th}$$ weight after the first $$n-1$$ weights have been placed).

Note that the perpendiculars to a new rotated orthogonal pair of axes from a given weight all lie on the circumference of the circle centred halfway between the origin and the weight, radius half the full distance from O to W.

This applies to each weight, and so there are a set of circles each with a common point on the circumference of the origin and the new axes intersect with these circles at the new distances.

From trigonometric identities, we have:


 * $$\begin{align}

\sin(\alpha + \beta) &= \sin \alpha \cos \beta + \cos \alpha \sin \beta \\ \cos(\alpha + \beta) &= \cos \alpha \cos \beta - \sin \alpha \sin \beta \end{align}$$

We know:


 * $$\begin{align}

\sum w_i \sin \alpha_i & =0 \\ \sum w_i \cos \alpha_i & =0 \end{align}$$

If $$\alpha_i$$ is the original angle, and $$\beta$$ is the rotated amount, then we have:


 * $$\begin{align}

w_i \sin(\alpha_i + \beta) &= w_i \sin \alpha_i \cos \beta + w_i \cos \alpha_i \sin \beta \\ w_i \cos(\alpha_i + \beta) &= w_i \cos \alpha_i \cos \beta - w_i \sin \alpha_i \sin \beta \end{align}$$

and summing:


 * $$\begin{align}

\sum w_i \sin(\alpha_i + \beta) &= \sum w_i \sin \alpha_i \cos \beta + \sum w_i \cos \alpha_i \sin \beta \\ \sum w_i \cos(\alpha_i + \beta) &= \sum w_i \cos \alpha_i \cos \beta - \sum w_i \sin \alpha_i \sin \beta \end{align}$$


 * $$\begin{align}

\sum w_i \sin(\alpha_i + \beta) &= \cos \beta \sum w_i \sin \alpha_i +  \sin \beta \sum w_i \cos \alpha_i  = 0 + 0 = 0\\ \sum w_i \cos(\alpha_i + \beta) &= \cos \beta \sum w_i \cos \alpha_i  - \sin \beta \sum  w_i \sin \alpha_i = 0 - 0 = 0 \end{align}$$

The resultant weighted vector at the origin is therefore zero, and this is invariant over axis rotation.

Or, the lines midway between two are balanced, and this process continues ad infinitum.

Convex function proofs
Consider $$f(x)=x^2$$, $$x\le y, 0\le t\le1$$. Then:

$$f(tx+(1-t)y)-tf(x)-(1-t)f(y)$$

$$=t^2x^2+2t(1-t)xy+(1-t)^2y^2-tx^2-(1-t)y^2$$

$$=t(t-1)x^2+2t(1-t)xy+(1-t)(-t)y^2$$

$$=-t(1-t)\left(x^2-2xy+y^2\right)$$

$$=-t(1-t)(x-y)^2$$

$$\le0$$

Consider $$f(x)=\log(x)$$, $$0<x\le y, 0\le t\le1$$. Then:

$$f(tx+(1-t)y)-tf(x)-(1-t)f(y)$$

$$=\log(tx+(1-t)y)-(t\log(x)+(1-t)\log(y))$$

$$=\log(tx+(1-t)y)-\log(x^ty^{1-t})$$

$$=\log(\frac{tx+(1-t)y}{x^ty^{1-t}})$$

So need to prove:

$$\frac{tx+(1-t)y}{x^ty^{1-t}}\ge1$$

or

$$tx+(1-t)y\ge x^ty^{1-t}$$

or, dividing by $$y$$:

$$t\left(\frac{x}{y}-1\right)+1\ge \left(\frac{x}{y}\right)^t$$

So:

$$t\left(\frac{x}{y}-1\right)+1 - \left(\frac{x}{y}\right)^t$$

$$=\left(\frac{x}{y}-1\right)\left(t - \frac{\left(\frac{x}{y}\right)^t-1}{\frac{x}{y}-1}\right)$$

$$=\left(\frac{x}{y}-1\right)\left(t - (1+\frac{x}{y}+\dots+\left(\frac{x}{y}\right)^{t-1})\right)$$

$$\ge0$$

Catalan q-polynomials
The Catalan q-polynomials $$C_k(q)$$ count the number of blocks present in the diagram under the diagonal height k, and start


 * $$C_0(q)=1$$
 * $$C_1(q)=1$$
 * $$C_2(q)=1+q$$
 * $$C_3(q)=1+q+2q^2+q^3$$
 * $$C_4(q)=1+q+2q^2+3q^3+3q^4+3q^5+q^6$$



The sum of the coefficients of $$C_k(q)$$ give $$C_k$$.

To generate the next level, we add a horizontal and vertical step. The horizontal step is always placed at the origin, and the vertical step can be placed anywhere off the bounding diagonal, and is the first time the path touches the diagonal.

The first path from the convolution is inserted along the (k-1)-th diagonal created by the two endpoints of the new steps, and the second is placed along the k-th diagonal.

With Dyck words, where the new template is $$X(k)Y(n-k)$$, where $$(k)$$ is a Dyck word of length $k$. The X step is always first, and the Y step comes after a $k$-length Dyck word.

The new polynomial is therefore the heights of the previous polynomials, plus the rectangle created by the insertion.


 * $$C_n(q) = \sum_{i=0}^{n-1} q^{i(n-i)}C_i(q)C_{n-i}(q)$$

For example, $$C_4(q)=q^0(1)(1+q+2q^2+q^3)+q^3(1)(1+q)+q^4(q+1)(1)+q^3(1+q+2q^2+q^3)(1)$$.

Cubic polynomial
Let


 * $$f(x) = ax^3 + bx^2 + cx + d$$

The local minima and maxima are given by the zeroes of the differential of $$f(x)$$.


 * $$f'(x) = 3ax^2 + 2bx + c$$
 * $$f'(x) = 0$$

i.e., by the quadratic formula, when


 * $$x = \frac{-2b\pm\sqrt{4b^2-12ac}}{6a} = \frac{-b\pm\sqrt{b^2-3ac}}{3a}$$

Let the two roots be $$r_1 < r_2$$.

Let w.l.o.g. $$f(r_1)$$ is the local maxima and $$f(r_2)$$ is the local minima.

$$f(r_1)$$ and :$$f(r_2)$$ have several terms equal, so


 * $$f(r_1) - f(r_2) = \frac{-2a}{27a^3}(3b^2\sqrt{b^2-3ac} + \sqrt{b^2-3ac}^3) + \frac{-2b}{9a^2}(2b\sqrt{b^2-3ac})^2 + \frac{-2c}{3a}(\sqrt{b^2-3ac})$$

which is essentially a quadratic.

We require


 * $$f(r_1) > 0 > f(r_2)$$

and if X is the common terms of each side, then this becomes


 * $$f(r_1) - X> -X > f(r_2) - X$$

6

 * 12 34 56
 * 13 26 45
 * 14 25 36
 * 15 23 46
 * 16 24 35

8

 * 12 34 58 67
 * 13 24 57 68
 * 14 25 36 78
 * 15 26 37 48
 * 16 27 38 45
 * 17 28 35 46
 * 18 23 47 56

GF for cubes

 * $$\frac{1+4x+x^2}{(1-x)^4} = 1 + 8x + 27x^2 + 64x^3 + 125x^4 + \dots$$

https://www.wolframalpha.com/input?i=%281%2B4x%2Bx%5E2%29%2F%281-x%29%5E4

The general relation is given by the Eulerian numbers.

Binomials
Prove


 * $$\binom{m}{j}\binom{n}{k} \le \binom{m+n}{j+k}$$


 * $$= \frac{m!n!}{j!k!(m-j)!(n-k)!} \le \frac{(m+n)!}{(j+k)!(m+n-j-k)!}$$

Consider


 * $$\frac{(m+n)!}{m!n!}\frac{j!k!}{(j+k)!}\frac{(m-j)!(n-k)!}{(m+n-j-k)!}$$

where


 * $$\frac{(a+b)!}{a!b!} = \binom{a+b}{a} = \frac{(a+1)\cdots(a+b)}{b!} = \prod_{i=1}^b \left(1+\frac{a}{i}\right)$$

so


 * $$\frac{\prod_{i=1}^m \left(1+\frac{n}{i}\right)}{\prod_{i=1}^j \left(1+\frac{k}{i}\right)\prod_{i=1}^{m-j} \left(1+\frac{n-k}{i}\right)}$$

and


 * $$\frac{\binom{m+n}{m}}{\binom{j+k}{j}\binom{m+n-j-k}{m-j}}$$

The meaning of logic
TRUTH


 * 0000 (0) FALSE
 * 0110 (6) XOR
 * 1001 (9) NXOR
 * 1111 (F) TRUE

IDEMPOTENT
 * 0001 (1) AND
 * 0011 (3) A
 * 0101 (5) B
 * 0111 (7) OR

INJECTIVE
 * 0100 (4) LT
 * 1100 (C) NB
 * 1101 (D) LTE
 * 1110 (E) NAND

SURJECTIVE
 * 0010 (2) GT
 * 1000 (8) NOR
 * 1011 (B) GTE
 * 1010 (A) NA

Partial sums of binomials

 * $$\sum_{i=0}^k \binom{n-k-1+i}{i}2^{n-k-i}$$


 * $$n=6, k=3: 1+6+15+20=42$$


 * $$\binom20 2^3 + \binom31 2^2 + \binom42 2 + \binom53 = 8+12+12+10=4$$2.

Pythagorean and 2 squares
Let $$(a,b,c)$$ be a Pythagorean triple, with a even.

Then both $$c-a$$ and $$c+a$$ are square numbers with roots r and s.

Then $$c=\left(\frac{r-s}{2}\right)^2+\left(\frac{r+s}{2}\right)^2$$

e.g. (48, 55, 73) ->73-48=25 (5) and 73+48=121 (11)

therefore 73=3^2+8^2

GF for Catalan numbers
Catalan number

Start with the GF for the central binomial coefficient.


 * $$\frac{1}{\sqrt{1-4x}}=\sum_{k=0}^\infty \binom{2k}{k}x^k$$

Integrating and setting the constant to $$\frac12$$ from the case $$x=0$$ yields


 * $$\frac{1-\sqrt{1-4x}}{2}=\sum_{k=0}^\infty \frac{1}{k+1}\binom{2k}{k}x^{k+1}$$

Divide by x to get


 * $$\frac{1-\sqrt{1-4x}}{2x}=\sum_{k=0}^\infty C_kx^k$$

Primitive roots
Primitive root modulo n

The order of an element is the smallest k where $$a^k\equiv1\pmod n$$.

k divides $$\phi(n)$$. Testing a candidate against each possible k returns negative if and only if the candidate is a primitive root.

Fermat's theorem on sums of two squares

(5) can be proved by Euler's criterion. It also tells us that if $$p=4k+1$$,


 * $$p|\prod_{i=1}^{4k} \left(i^{2k} + (i-1)^{2k}\right)$$

which is the sum of two squares by (1). (2), (3) and (4) can then be used to find it.

Finding primitive roots for primes
For each prime p of p-1, remove k^p from 1,..,p-1 as k runs over the same range. Only primitive roots remain.

Fermat's little power test

 * $$a^k \equiv 1 \pmod p$$ if and only if $$k|p-1$$

For example, $$x^7-1$$ is never divisible by 13, 17, etc..., but is by 29.

Chinese Remainder Theorem
Say $$x\equiv a \pmod p$$, and also $$x\equiv b \pmod q$$ with p,q primes, and a,b least residues.

Note that $$p^{q-1}$$ is $$0\pmod p$$ and $$1\pmod q$$. Similarly $$q^{p-1}$$ is $$1\pmod p$$ and $$0\pmod q$$.

Therefore $$aq^{p-1} + bp^{q-1} \equiv a \pmod p$$ and $$aq^{p-1} + bp^{q-1} \equiv b \pmod q$$, and so $$x\equiv aq^{p-1} + bp^{q-1} \pmod {pq}$$

Plane partition GF
Plane partition

The GF is


 * $$\prod_{i=1}^{\infty} \frac1{(1-x^i)^i}$$

Consider instead the much simpler GF of


 * $$\frac1{1-x}\prod_{i=2}^{\infty} \frac1{(1-x^i)^2}$$

The n-th term is the number of partitions of n into at least 0 parts + partitions of n-1 into at least 1 part + partitions of n-2 into at least 2 parts + etc...

Proof
The GF for at least k parts is


 * $$LP_k = x^k\prod_{i=1}^{k} \frac1{(1-x^i)}\prod_{i=1}^{\infty} \frac1{(1-x^i)}$$

and


 * $$\sum_{k=0}^\infty LP_k = \prod_{i=1}^{\infty} \frac1{(1-x^i)^2}$$

and we have counted the single x twice.

Coordinates of circumcentre
Let $$\triangle ABC$$ be coordinates $$(x_1,y_1),(x_2,y_2),(x_3,y_3)$$. Then the midpoints of AB and AC are


 * $$\left(\frac{x_1+x_2}{2},\frac{y_1+y_2}{2}\right)$$
 * $$\left(\frac{x_1+x_3}{2},\frac{y_1+y_3}{2}\right)$$

The perpendiculars are


 * $$\binom{y_2-y_1}{x_1-x_2}$$
 * $$\binom{y_3-y_1}{x_1-x_3}$$

and the equations of the perpendiculars through the midpoints are


 * $$\binom{x}{y} = \binom{\frac{x_1+x_2}{2}}{\frac{y_1+y_2}{2}} + s\binom{y_2-y_1}{x_1-x_2}$$
 * $$\binom{x}{y} = \binom{\frac{x_1+x_3}{2}}{\frac{y_1+y_3}{2}} + t\binom{y_3-y_1}{x_1-x_3}$$

with equality when


 * $$\frac{x_1+x_2}{2} + s(y_2-y_1) = \frac{x_1+x_3}{2}+ t(y_3-y_1)$$
 * $$\frac{y_1+y_2}{2} + s(x_1-x_2) = \frac{y_1+y_3}{2} + t(x_1-x_3)$$

so


 * $$(x_2-x_3) + 2s(y_2-y_1) = 2t(y_3-y_1)$$
 * $$(y_2-y_3) + 2s(x_1-x_2) = 2t(x_1-x_3)$$

and then


 * $$(x_2-x_3)(x_1-x_2) + 2s(x_1-x_2)(y_2-y_1) = 2t(x_1-x_2)(y_3-y_1)$$
 * $$(y_2-y_3)(y_2-y_1) + 2s(x_1-x_2)(y_2-y_1) = 2t(x_1-x_3)(y_2-y_1)$$

so


 * $$(x_2-x_3)(x_1-x_2) - (y_2-y_3)(y_2-y_1) = 2t(x_1y_3-x_2y_3+x_2y_1-x_1y_2+x_3y_2-x_3y_1)$$

zeta log functions
Namely,


 * $$\prod_{p\in prime} 1-\log\left(1-\frac1{p^s}\right)$$


 * $$e^{\sum\limits_{p\in prime} \frac1{p^s}}$$

Hamiltonian cycles
Hamiltonian cycles

Generate the permutations of all vertices. Remove all those with non-adjacent vertices.

Binary divide
Given n and d, left-shift d until it is greater than n, and then single right shift. Subtract this value from n and repeat until remainder is less than d.

Base conversion
An integer in base b can be written as


 * $$n = \sum_{i=0}^N a_ib^i$$

and the same integer in base d is


 * $$n = \sum_{i=0}^M c_id^i$$

If $$d+e=b$$, then the first equation becomes


 * $$n = \sum_{i=0}^N a_i(d+e)^i$$

Expand this using the binomial formula to get


 * $$n = \sum_{i=0}^N a_i\sum_{k=0}^i \binom{i}{k}e^kd^{i-k}$$

and collect by like terms in d to get the second equation.

Presentation of the sphere group
The presentation of a group is defined by the generators of the groups involved and their identities.

The sphere group is obtained by tending k to infinity for two cyclic groups g and h, order 4k.

There are two types of identities, the polar identities, from the fact that both poles are stable points, hence given $$0\le a<4k$$, $$h^kg^ah^{-k}=g^kh^ag^{-k}=I$$, and the equator identities, from the two routes from pole to pole, $$g^{2k}h^{2k}=h^{2k}g^{2k}=I$$.

The torus doesn't have either of these identities.

The first corresponds to the fact that if one of the generators is rotations $$G_z$$ about the z axis (i.e. the x-y plane), then it affects only x and y components, of which the singularity at $$(x,y,z)=(0,0,1)$$ is not affected, and so it is a stable point of $$G_z$$.

The second describes a contour, where the order of the two groups is halved (i.e. order 2k) due to the lack of a pole. The path then moves close to the pole, does half a circle around the inner circle, back to the equator, but on the other side, and then back around the outer circle.

Homotopy
Homotopy cam be used to define the trivial fundamental group. Let $$(a,b)$$ be a point inside $$H(x,0)$$ and $$H(x,1)$$. Then there exists a tuple $$(x,t)$$ such that $$H(x,t)=(a,b)$$. If $$(a,b)$$ is not available, then the fundamental group is not trivial.