  We investigate the convexity property on $(0,1)$ of the function
$$f_a(x)=\frac{{\cal K}{(\sqrt x)}}{a-(1/2)\log(1-x)}.$$ We show that $f_a$ is
strictly convex on $(0,1)$ if and only if $a\geq a_c$ and $1/f_a$ is strictly
convex on $(0,1)$ if and only if $a\leq\log 4$, where $a_c$ is some critical
value. The second main result of the paper is to study the log-convexity and
log-concavity of the function $$h_p(x)=(1-x)^p{\cal K}(\sqrt x).$$ We prove
that $h_p$ is strictly log-concave on $(0,1)$ if and only if $p\geq 7/32$ and
strictly log-convex if and only if $p\leq 0$. This solves some problems posed
by Yang and Tian and complete their result and a result of Alzer and Richards
that $f_a$ is strictly concave on $(0,1)$ if and only if $a=4/3$ and $1/f_a$ is
strictly concave on $(0,1)$ if and only if $a\geq 8/5$. As applications of the
convexity and concavity, we establish among other inequalities, that for $a\geq
a_c$ and all $r\in(0,1)$ $$\frac{2\pi\sqrt\pi}{(2a+\log 2)\Gamma(3/4)^2}\leq
\frac{{\cal K}(\sqrt r)}{a-\frac12\log (r)}+\frac{{\cal
K}(\sqrt{1-r})}{a-\frac12\log (1-r)}<1+\frac\pi{2a},$$ and for $p\geq 3(2+\sqrt
2)/8$ and all $r\in(0,1)$ $$\sqrt{(r-r^2)^p{\cal K}(\sqrt{1-r}){\cal K}(\sqrt
r)}< \frac{\pi\sqrt\pi}{2^{p+1}\Gamma(3/4)^2}<\frac{r^p{\cal
K}(\sqrt{1-r})+(1-r)^p{\cal K}(\sqrt r)}{2}.$$
